diff options
Diffstat (limited to 'compiler-rt/test/asan/TestCases/recoverable-lsan.cc')
| -rw-r--r-- | compiler-rt/test/asan/TestCases/recoverable-lsan.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/compiler-rt/test/asan/TestCases/recoverable-lsan.cc b/compiler-rt/test/asan/TestCases/recoverable-lsan.cc new file mode 100644 index 00000000000..99720601291 --- /dev/null +++ b/compiler-rt/test/asan/TestCases/recoverable-lsan.cc @@ -0,0 +1,21 @@ +// Ensure that output is the same but exit code depends on halt_on_error value +// RUN: %clangxx_asan %s -o %t +// RUN: %env_asan_opts="halt_on_error=0" %run %t 2>&1 | FileCheck %s +// RUN: %env_asan_opts="halt_on_error=1" not %run %t 2>&1 | FileCheck %s +// RUN: not %run %t 2>&1 | FileCheck %s + +#include <stdlib.h> + +int f() { + volatile int *a = (int *)malloc(20); + a[0] = 1; + return a[0]; +} + +int main() { + f(); + f(); +} + +// CHECK: LeakSanitizer: detected memory leaks +// CHECK: SUMMARY: AddressSanitizer: 20 byte(s) leaked |

