1 // RUN: %clang_dfsan %s -mllvm -dfsan-combine-offset-labels-on-gep=false -Wno-error=int-conversion -o %t && %run %t
2 // RUN: %clang_dfsan %s -DPROP_OFFSET_LABELS -Wno-error=int-conversion -o %t && %run %t
4 // Tests that labels are propagated through GEP.
6 #include <sanitizer/dfsan_interface.h>
13 // test that pointer arithmetic propagates labels in terms of the flag.
14 dfsan_set_label(1, &i
, sizeof(i
));
16 #ifdef PROP_OFFSET_LABELS
17 assert(dfsan_get_label(p
) == 1);
19 assert(dfsan_get_label(p
) == 0);
21 // test that non-pointer operations always propagate labels.
22 dfsan_set_label(2, &j
, sizeof(j
));
24 assert(dfsan_get_label(j
) == 3);