1// RUN: %clang_dfsan -gmlt -mllvm -dfsan-track-origins=1 -mllvm -dfsan-fast-16-labels=true %s -o %t && \
2// RUN: %run %t >%t.out 2>&1
3// RUN: FileCheck %s --check-prefix=CHECK < %t.out
4//
5// REQUIRES: x86_64-target-arch
6
7#include <sanitizer/dfsan_interface.h>
8
9int main(int argc, char *argv[]) {
10 char volatile z1;
11 char volatile z2;
12 dfsan_set_label(8, (void *)&z1, sizeof(z1));
13 dfsan_set_label(16, (void *)&z2, sizeof(z2)); // overwritting the old origin.
14 char c = z1;
15 dfsan_print_origin_trace(&c, "bar");
16 return 0;
17}
18
19// CHECK: Taint value 0x8 {{.*}} origin tracking (bar)
20// CHECK: Origin value: {{.*}}, Taint value was stored to memory at
21// CHECK: #0 {{.*}} in main {{.*}}origin_overlapped.c:[[@LINE-7]]
22
23// CHECK: Origin value: {{.*}}, Taint value was created at
24
25// CHECK: #0 {{.*}} in main {{.*}}origin_overlapped.c:[[@LINE-12]]
26