Marco Elver | 14de6e2 | 2020-05-26 12:51:46 -0700 | [diff] [blame] | 1 | // RUN: %clang %s -target x86_64-unknown-linux-gnu -emit-llvm -S -fsanitize-coverage=trace-pc,trace-cmp -o - | FileCheck %s --check-prefixes=CHECK |
| 2 | // RUN: %clang %s -target x86_64-unknown-linux-gnu -emit-llvm -S -fsanitize=address -fsanitize-coverage=trace-pc,trace-cmp -o - | FileCheck %s --check-prefixes=CHECK,ASAN |
| 3 | // RUN: %clang %s -target x86_64-unknown-linux-gnu -emit-llvm -S -fsanitize=bounds -fsanitize-coverage=trace-pc,trace-cmp -o - | FileCheck %s --check-prefixes=CHECK,BOUNDS |
| 4 | // RUN: %clang %s -target x86_64-unknown-linux-gnu -emit-llvm -S -fsanitize=memory -fsanitize-coverage=trace-pc,trace-cmp -o - | FileCheck %s --check-prefixes=CHECK,MSAN |
| 5 | // RUN: %clang %s -target x86_64-unknown-linux-gnu -emit-llvm -S -fsanitize=thread -fsanitize-coverage=trace-pc,trace-cmp -o - | FileCheck %s --check-prefixes=CHECK,TSAN |
| 6 | // RUN: %clang %s -target x86_64-unknown-linux-gnu -emit-llvm -S -fsanitize=undefined -fsanitize-coverage=trace-pc,trace-cmp -o - | FileCheck %s --check-prefixes=CHECK,UBSAN |
Marco Elver | 69935d8 | 2020-05-27 23:55:53 +0200 | [diff] [blame] | 7 | // |
| 8 | // Host armv7 is currently unsupported: https://bugs.llvm.org/show_bug.cgi?id=46117 |
| 9 | // XFAIL: armv7, thumbv7 |
Marco Elver | 14de6e2 | 2020-05-26 12:51:46 -0700 | [diff] [blame] | 10 | |
| 11 | int x[10]; |
| 12 | |
| 13 | // CHECK-LABEL: define dso_local void @foo( |
| 14 | void foo(int n) { |
| 15 | // CHECK-DAG: call void @__sanitizer_cov_trace_pc |
| 16 | // CHECK-DAG: call void @__sanitizer_cov_trace_const_cmp |
| 17 | // ASAN-DAG: call void @__asan_report_store |
| 18 | // MSAN-DAG: call void @__msan_warning |
| 19 | // BOUNDS-DAG: call void @__ubsan_handle_out_of_bounds |
| 20 | // TSAN-DAG: call void @__tsan_func_entry |
| 21 | // UBSAN-DAG: call void @__ubsan_handle |
| 22 | if (n) |
| 23 | x[n] = 42; |
| 24 | } |
| 25 | // CHECK-LABEL: declare void |