Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / dfsan / basic.c
blob201055350af8e8ccb7a32c3812dc470deecd3463
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>
6 #include <assert.h>
8 int main(void) {
9 int i = 1;
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));
26 return 0;