1 // RUN: %clang_dfsan -gmlt -mllvm -dfsan-track-origins=1 %s -o %t
3 // RUN: %run %t >%t.out 2>&1
4 // RUN: FileCheck %s < %t.out
6 // RUN: DFSAN_OPTIONS=origin_history_size=2 %run %t >%t.out 2>&1
7 // RUN: FileCheck %s --check-prefix=CHECK2 < %t.out
9 // RUN: DFSAN_OPTIONS=origin_history_size=0 %run %t >%t.out 2>&1
10 // RUN: FileCheck %s --check-prefix=CHECK0 < %t.out
12 #include <sanitizer/dfsan_interface.h>
16 __attribute__((noinline
)) int foo(int a
, int b
) { return a
+ b
; }
18 int main(int argc
, char *argv
[]) {
20 dfsan_set_label(8, &a
, sizeof(a
));
22 for (int i
= 0; i
< 17; ++i
) {
24 printf("%lx", (unsigned long)&c
);
26 dfsan_print_origin_trace(&c
, NULL
);
29 // CHECK: Taint value 0x8 {{.*}} origin tracking ()
30 // CHECK-COUNT 14: Origin value: {{.*}}, Taint value was stored to memory at
31 // CHECK: Origin value: {{.*}}, Taint value was created at
33 // CHECK2: Taint value 0x8 {{.*}} origin tracking ()
34 // CHECK2: Origin value: {{.*}}, Taint value was stored to memory at
35 // CHECK2: Origin value: {{.*}}, Taint value was created at
37 // CHECK0: Taint value 0x8 {{.*}} origin tracking ()
38 // CHECK0-COUNT 16: Origin value: {{.*}}, Taint value was stored to memory at
39 // CHECK0: Origin value: {{.*}}, Taint value was created at