xref: /llvm-project/compiler-rt/test/asan/TestCases/report_error_summary.cpp (revision 53a81d4d26f0409de8a0655d7af90f2bea222a12)
1 // RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
2 
3 #include <stdio.h>
4 
5 // Required for ld64 macOS 12.0+
6 __attribute__((weak)) extern "C" void foo() {}
7 
8 extern "C" void __sanitizer_report_error_summary(const char *summary) {
9   fprintf(stderr, "test_report_error_summary\n");
10   // CHECK: test_report_error_summary
11   fflush(stderr);
12 }
13 
14 char *x;
15 
16 int main() {
17   x = new char[20];
18   delete[] x;
19   return x[0];
20 }
21