Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / asan / TestCases / halt_on_error-1.c
blob63c65e58bb71b3a251e39961cd61567b370aeca8
1 // Test recovery mode.
2 //
3 // RUN: %clang_asan -fsanitize-recover=address %s -o %t
4 //
5 // RUN: env not %run %t 2>&1 | FileCheck %s
6 // RUN: %env_asan_opts=halt_on_error=true not %run %t 2>&1 | FileCheck %s
7 // RUN: %env_asan_opts=halt_on_error=false %run %t 2>&1 | FileCheck %s --check-prefix CHECK-RECOVER
9 #include <string.h>
11 volatile int ten = 10;
13 int main() {
14 char x[10];
15 // CHECK: WRITE of size 11
16 // CHECK-RECOVER: WRITE of size 11
17 memset(x, 0, 11);
18 // CHECK-NOT: READ of size 1
19 // CHECK-RECOVER: READ of size 1
20 volatile int res = x[ten];
21 // CHECK-NOT: WRITE of size 1
22 // CHECK-RECOVER: WRITE of size 1
23 x[ten] = res + 3;
24 // CHECK-NOT: READ of size 1
25 // CHECK-RECOVER: READ of size 1
26 res = x[ten];
27 return 0;