blob: ea4ac9296b48fab929ed97c58b1b6ea9735f1fbf [file] [log] [blame]
Marco Elver14de6e22020-05-26 12:51:46 -07001// 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 Elver69935d82020-05-27 23:55:53 +02007//
8// Host armv7 is currently unsupported: https://bugs.llvm.org/show_bug.cgi?id=46117
9// XFAIL: armv7, thumbv7
Marco Elver14de6e22020-05-26 12:51:46 -070010
11int x[10];
12
13// CHECK-LABEL: define dso_local void @foo(
14void 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