1// RUN: %clangxx_asan -O0 %s -o %t
2// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=SOURCE
3// RUN: %env_asan_opts=symbolize=false not %run %t 2>&1 | FileCheck %s --check-prefix=MODULE
4// RUN: %env_asan_opts=print_summary=false not %run %t 2>&1 | FileCheck %s --check-prefix=MISSING
5
6int main() {
7 char *x = new char[20];
8 delete[] x;
9 return x[0];
10 // SOURCE: ERROR: AddressSanitizer: heap-use-after-free
11 // SOURCE: SUMMARY: AddressSanitizer: heap-use-after-free {{.*}}print_summary.cpp:[[@LINE-2]]{{.*}} main
12 // MODULE: ERROR: AddressSanitizer: heap-use-after-free
13 // MODULE: SUMMARY: AddressSanitizer: heap-use-after-free ({{.*}}+0x{{.*}})
14 // MISSING: ERROR: AddressSanitizer: heap-use-after-free
15 // MISSING-NOT: SUMMARY
16}
17

source code of compiler-rt/test/asan/TestCases/print_summary.cpp