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