Mercurial > hg > CbC > CbC_llvm
view compiler-rt/test/dfsan/origin_limit.c @ 222:81f6424ef0e3 llvm-original
LLVM original branch
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 18 Jul 2021 22:10:01 +0900 |
parents | 79ff65ed7e25 |
children | 5f17cb93ff66 |
line wrap: on
line source
// RUN: %clang_dfsan -gmlt -mllvm -dfsan-track-origins=1 -mllvm -dfsan-fast-16-labels=true %s -o %t // // RUN: %run %t >%t.out 2>&1 // RUN: FileCheck %s --check-prefix=CHECK < %t.out // // RUN: DFSAN_OPTIONS=origin_history_size=2 %run %t >%t.out 2>&1 // RUN: FileCheck %s --check-prefix=CHECK2 < %t.out // // RUN: DFSAN_OPTIONS=origin_history_size=0 %run %t >%t.out 2>&1 // RUN: FileCheck %s --check-prefix=CHECK0 < %t.out // // REQUIRES: x86_64-target-arch #include <sanitizer/dfsan_interface.h> #include <stdio.h> __attribute__((noinline)) int foo(int a, int b) { return a + b; } int main(int argc, char *argv[]) { int a = 10; dfsan_set_label(8, &a, sizeof(a)); int c = 0; for (int i = 0; i < 17; ++i) { c = foo(a, c); printf("%lx", (unsigned long)&c); } dfsan_print_origin_trace(&c, NULL); } // CHECK: Taint value 0x8 {{.*}} origin tracking () // CHECK-COUNT 14: Origin value: {{.*}}, Taint value was stored to memory at // CHECK: Origin value: {{.*}}, Taint value was created at // CHECK2: Taint value 0x8 {{.*}} origin tracking () // CHECK2: Origin value: {{.*}}, Taint value was stored to memory at // CHECK2: Origin value: {{.*}}, Taint value was created at // CHECK0: Taint value 0x8 {{.*}} origin tracking () // CHECK0-COUNT 16: Origin value: {{.*}}, Taint value was stored to memory at // CHECK0: Origin value: {{.*}}, Taint value was created at