| 1 | // Check that with empty ASAN_OPTIONS, ASan reports on Linux don't crash |
| 2 | // the process (abort_on_error=0). See also Darwin/abort_on_error.cpp. |
| 3 | |
| 4 | // RUN: %clangxx_asan %s -o %t |
| 5 | |
| 6 | // Intentionally don't inherit the default ASAN_OPTIONS. |
| 7 | // RUN: env ASAN_OPTIONS="" not %run %t 2>&1 | FileCheck %s |
| 8 | // When we use lit's default ASAN_OPTIONS, we shouldn't crash either. On Linux |
| 9 | // lit doesn't set ASAN_OPTIONS anyway. |
| 10 | // RUN: not %run %t 2>&1 | FileCheck %s |
| 11 | |
| 12 | // Android runs with abort_on_error=0 |
| 13 | // UNSUPPORTED: android |
| 14 | |
| 15 | #include <stdlib.h> |
| 16 | int main() { |
| 17 | char *x = (char*)malloc(size: 10 * sizeof(char)); |
| 18 | free(ptr: x); |
| 19 | return x[5]; |
| 20 | // CHECK: {{.*ERROR: AddressSanitizer: heap-use-after-free on address}} |
| 21 | } |
| 22 | |