1 // RUN: %clang_dfsan %s -o %t && %run %t
3 // Tests that labels are propagated through loads and stores.
5 #include <sanitizer/dfsan_interface.h>
10 dfsan_label i_label
= 1;
11 dfsan_set_label(i_label
, &i
, sizeof(i
));
13 dfsan_label new_label
= dfsan_get_label(i
);
14 assert(i_label
== new_label
);
16 dfsan_label read_label
= dfsan_read_label(&i
, sizeof(i
));
17 assert(i_label
== read_label
);
19 dfsan_label j_label
= 2;
20 dfsan_add_label(j_label
, &i
, sizeof(i
));
22 read_label
= dfsan_read_label(&i
, sizeof(i
));
23 assert(dfsan_has_label(read_label
, i_label
));
24 assert(dfsan_has_label(read_label
, j_label
));