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
4
5#include <sanitizer/dfsan_interface.h>
6
7int main(int argc, char *argv[]) {
8 char volatile z1;
9 char volatile z2;
10 dfsan_set_label(label: 8, addr: (void *)&z1, size: sizeof(z1));
11 dfsan_set_label(label: 16, addr: (void *)&z2, size: sizeof(z2)); // overwritting the old origin.
12 char c = z1;
13 dfsan_print_origin_trace(addr: &c, description: "bar");
14 return 0;
15}
16
17// CHECK: Taint value 0x8 {{.*}} origin tracking (bar)
18// CHECK: Origin value: {{.*}}, Taint value was stored to memory at
19// CHECK: #0 {{.*}} in main {{.*}}origin_overlapped.c:[[@LINE-7]]
20
21// CHECK: Origin value: {{.*}}, Taint value was created at
22
23// CHECK: #0 {{.*}} in main {{.*}}origin_overlapped.c:[[@LINE-12]]
24

source code of compiler-rt/test/dfsan/origin_overlapped.c