brintos

brintos / llvm-project-archived public Read only

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