]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/asan/TestCases/on_error_callback.cc
Vendor import of compiler-rt trunk r256633:
[FreeBSD/FreeBSD.git] / test / asan / TestCases / on_error_callback.cc
1 // RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s
2
3 #include <stdio.h>
4 #include <stdlib.h>
5
6 extern "C"
7 void __asan_on_error() {
8   fprintf(stderr, "__asan_on_error called\n");
9   fflush(stderr);
10 }
11
12 int main() {
13   char *x = (char*)malloc(10 * sizeof(char));
14   free(x);
15   return x[5];
16   // CHECK: __asan_on_error called
17 }