1*673dc3d4SNico Weber // RUN: %clangxx_asan -O0 %s -o %t
2*673dc3d4SNico Weber // RUN: not %run %t 0 2>&1 | FileCheck %s
3*673dc3d4SNico Weber 
4*673dc3d4SNico Weber #include <sanitizer/asan_interface.h>
5*673dc3d4SNico Weber #include <stdio.h>
6*673dc3d4SNico Weber 
ErrorReportCallbackOneToZ(const char * report)7*673dc3d4SNico Weber static void ErrorReportCallbackOneToZ(const char *report) {
8*673dc3d4SNico Weber   fprintf(stderr, "ABCDEF%sGHIJKL", report);
9*673dc3d4SNico Weber   fflush(stderr);
10*673dc3d4SNico Weber }
11*673dc3d4SNico Weber 
main(int argc,char ** argv)12*673dc3d4SNico Weber int main(int argc, char **argv) {
13*673dc3d4SNico Weber   __asan_set_error_report_callback(ErrorReportCallbackOneToZ);
14*673dc3d4SNico Weber   __asan_report_error(
15*673dc3d4SNico Weber       (void *)__builtin_extract_return_addr(__builtin_return_address(0)), 0, 0,
16*673dc3d4SNico Weber       0, true, 1);
17*673dc3d4SNico Weber   // CHECK: ABCDEF
18*673dc3d4SNico Weber   // CHECK: ERROR: AddressSanitizer
19*673dc3d4SNico Weber   // CHECK: GHIJKL
20*673dc3d4SNico Weber   return 0;
21*673dc3d4SNico Weber }
22