Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / asan / TestCases / Linux / recoverable-lsan.cpp
blob935645327b00a9146342d712f7d2ce80bf32f6c3
1 // Ensure that output is the same but exit code depends on halt_on_error value
2 // RUN: %clangxx_asan %s -o %t
3 // RUN: %env_asan_opts="halt_on_error=0" %run %t 2>&1 | FileCheck %s
4 // RUN: %env_asan_opts="halt_on_error=1" not %run %t 2>&1 | FileCheck %s
5 // RUN: not %run %t 2>&1 | FileCheck %s
6 // REQUIRES: leak-detection
7 // UNSUPPORTED: android
9 #include <stdlib.h>
11 int f() {
12 volatile int *a = (int *)malloc(20);
13 a[0] = 1;
14 return a[0];
17 int main() {
18 f();
19 f();
22 // CHECK: LeakSanitizer: detected memory leaks