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 // REQUIRES: x86_64-target-arch
11 #include <sanitizer/dfsan_interface.h>
13 __attribute__((noinline
)) uint64_t foo(uint64_t a
, uint64_t b
) { return a
+ b
; }
15 int main(int argc
, char *argv
[]) {
18 dfsan_add_label(4, &a
, sizeof(a
));
19 dfsan_add_label(8, &a
, sizeof(a
));
20 uint64_t c
= foo(a
, b
);
21 dfsan_print_origin_trace(&c
, NULL
);
22 dfsan_print_origin_trace((int*)&c
+ 1, NULL
);
25 // CHECK: Taint value 0xc {{.*}} origin tracking ()
26 // CHECK: Origin value: {{.*}}, Taint value was stored to memory at
27 // CHECK: #0 {{.*}} in main {{.*}}origin_add_label.c:[[@LINE-7]]
29 // CHECK: Origin value: {{.*}}, Taint value was created at
30 // CHECK: #0 {{.*}} in main {{.*}}origin_add_label.c:[[@LINE-11]]
32 // CHECK: Taint value 0xc {{.*}} origin tracking ()
33 // CHECK: Origin value: {{.*}}, Taint value was stored to memory at
34 // CHECK: #0 {{.*}} in main {{.*}}origin_add_label.c:[[@LINE-14]]
36 // CHECK: Origin value: {{.*}}, Taint value was created at
37 // CHECK: #0 {{.*}} in main {{.*}}origin_add_label.c:[[@LINE-18]]