1 // RUN: %clang_dfsan -gmlt -mllvm -dfsan-track-origins=1 %s -o %t && \
2 // RUN: %run %t >%t.out 2>&1
3 // RUN: FileCheck %s < %t.out
5 // RUN: %clang_dfsan -gmlt -mllvm -dfsan-track-origins=1 -mllvm -dfsan-instrument-with-call-threshold=0 %s -o %t && \
6 // RUN: %run %t >%t.out 2>&1
7 // RUN: FileCheck %s < %t.out
9 #include <sanitizer/dfsan_interface.h>
11 __attribute__((noinline
)) uint64_t foo(uint64_t a
, uint64_t b
) { return a
+ b
; }
13 int main(int argc
, char *argv
[]) {
16 dfsan_add_label(4, &a
, sizeof(a
));
17 dfsan_add_label(8, &a
, sizeof(a
));
18 uint64_t c
= foo(a
, b
);
19 dfsan_print_origin_trace(&c
, NULL
);
20 dfsan_print_origin_trace((int*)&c
+ 1, NULL
);
23 // CHECK: Taint value 0xc {{.*}} origin tracking ()
24 // CHECK: Origin value: {{.*}}, Taint value was stored to memory at
25 // CHECK: #0 {{.*}} in main {{.*}}origin_add_label.c:[[@LINE-7]]
27 // CHECK: Origin value: {{.*}}, Taint value was created at
28 // CHECK: #0 {{.*}} in main {{.*}}origin_add_label.c:[[@LINE-11]]
30 // CHECK: Taint value 0xc {{.*}} origin tracking ()
31 // CHECK: Origin value: {{.*}}, Taint value was stored to memory at
32 // CHECK: #0 {{.*}} in main {{.*}}origin_add_label.c:[[@LINE-14]]
34 // CHECK: Origin value: {{.*}}, Taint value was created at
35 // CHECK: #0 {{.*}} in main {{.*}}origin_add_label.c:[[@LINE-18]]