17 lines · cpp
1// RUN: %clangxx_asan -O0 %s -o %t2// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=SOURCE3// RUN: %env_asan_opts=symbolize=false not %run %t 2>&1 | FileCheck %s --check-prefix=MODULE4// RUN: %env_asan_opts=print_summary=false not %run %t 2>&1 | FileCheck %s --check-prefix=MISSING5 6int main() {7 char *x = new char[20];8 delete[] x;9 return x[0];10 // SOURCE: ERROR: AddressSanitizer: heap-use-after-free11 // SOURCE: SUMMARY: AddressSanitizer: heap-use-after-free {{.*}}print_summary.cpp:[[@LINE-2]]{{.*}} main12 // MODULE: ERROR: AddressSanitizer: heap-use-after-free13 // MODULE: SUMMARY: AddressSanitizer: heap-use-after-free ({{.*}}+0x{{.*}})14 // MISSING: ERROR: AddressSanitizer: heap-use-after-free15 // MISSING-NOT: SUMMARY16}17