Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / sanitizer_common / TestCases / Darwin / abort_on_error.cpp
blobf94bd51ed9e042c14417934273f43a19a4dce29e
1 // Check that sanitizers on OS X crash the process by default (i.e.
2 // abort_on_error=1). See also Linux/abort_on_error.cpp.
4 // RUN: %clangxx -DUSING_%tool_name %s -o %t
6 // Intentionally don't inherit the default options.
7 // RUN: env %tool_options='' TSAN_OPTIONS=ignore_interceptors_accesses=0 not --crash %run %t 2>&1
9 // When we use lit's default options, we shouldn't crash.
10 // RUN: not %run %t 2>&1
12 // Leak detection isn't treated as an error so `abort_on_error=1` doesn't work.
13 // UNSUPPORTED: lsan
15 int global;
17 int main() {
18 #if defined(USING_ubsan)
19 volatile int *null = 0;
20 *null = 0;
21 #else
22 volatile int *a = new int[100];
23 delete[] a;
24 global = a[0]; // use-after-free: triggers ASan/TSan report.
25 #endif
26 return 0;