Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / dfsan / origin_branch.c
blobec15506c760c3862cd943373146efef7993ed697
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 #include <sanitizer/dfsan_interface.h>
7 __attribute__((noinline)) uint64_t foo(uint64_t x, uint64_t y) { return x + y; }
9 int main(int argc, char *argv[]) {
10 uint64_t a = 10;
11 uint64_t b = 20;
12 dfsan_set_label(8, &a, sizeof(a));
13 uint64_t c = foo(a, b);
14 for (int i = 0; i < argc; ++i)
15 c += foo(c, b);
16 dfsan_print_origin_trace(&c, NULL);
19 // CHECK: Taint value 0x8 {{.*}} origin tracking ()
20 // CHECK: Origin value: {{.*}}, Taint value was stored to memory at
21 // CHECK: #0 {{.*}} in main {{.*}}origin_branch.c:[[@LINE-6]]
23 // CHECK: Origin value: {{.*}}, Taint value was stored to memory at
24 // CHECK: #0 {{.*}} in main {{.*}}origin_branch.c:[[@LINE-11]]
26 // CHECK: Origin value: {{.*}}, Taint value was created at
27 // CHECK: #0 {{.*}} in main {{.*}}origin_branch.c:[[@LINE-15]]