1 // Tests dfsan_flush().
2 // RUN: %clang_dfsan %s -o %t && %run %t
3 // RUN: %clang_dfsan -DORIGIN_TRACKING -mllvm -dfsan-track-origins=1 %s -o %t && %run %t
5 #include <sanitizer/dfsan_interface.h>
13 int *heap
= (int*)malloc(sizeof(int));
15 dfsan_set_label(10, &global
, sizeof(global
));
16 dfsan_set_label(20, &local
, sizeof(local
));
17 dfsan_set_label(30, heap
, sizeof(*heap
));
19 assert(dfsan_get_label(global
) == 10);
20 assert(dfsan_get_label(local
) == 20);
21 assert(dfsan_get_label(*heap
) == 30);
22 #ifdef ORIGIN_TRACKING
23 assert(dfsan_get_origin(global
));
24 assert(dfsan_get_origin(local
));
25 assert(dfsan_get_origin(*heap
));
30 assert(dfsan_get_label(global
) == 0);
31 assert(dfsan_get_label(local
) == 0);
32 assert(dfsan_get_label(*heap
) == 0);
33 assert(dfsan_get_origin(global
) == 0);
34 assert(dfsan_get_origin(local
) == 0);
35 assert(dfsan_get_origin(*heap
) == 0);