1 | // RUN: %clang_dfsan %s -o %t && %run %t |
2 | // RUN: %clang_dfsan -mllvm -dfsan-args-abi %s -o %t && %run %t |
3 | // |
4 | // REQUIRES: x86_64-target-arch |
5 | // |
6 | // Tests that labels are propagated through function calls. |
7 | |
8 | #include <sanitizer/dfsan_interface.h> |
9 | #include <assert.h> |
10 | |
11 | int f(int x) { |
12 | int j = 2; |
13 | dfsan_label j_label = dfsan_create_label("j" , 0); |
14 | dfsan_set_label(j_label, &j, sizeof(j)); |
15 | return x + j; |
16 | } |
17 | |
18 | int main(void) { |
19 | int i = 1; |
20 | dfsan_label i_label = dfsan_create_label("i" , 0); |
21 | dfsan_set_label(i_label, &i, sizeof(i)); |
22 | |
23 | dfsan_label ij_label = dfsan_get_label(f(i)); |
24 | assert(dfsan_has_label(ij_label, i_label)); |
25 | assert(dfsan_has_label_with_desc(ij_label, "j" )); |
26 | |
27 | return 0; |
28 | } |
29 | |