Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 1 | // RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s |
2 | |||||
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 3 | #include <stdio.h> |
4 | #include <stdlib.h> | ||||
5 | |||||
6 | extern "C" | ||||
7 | void __asan_on_error() { | ||||
8 | fprintf(stderr, "__asan_on_error called"); | ||||
9 | } | ||||
10 | |||||
11 | int main() { | ||||
12 | char *x = (char*)malloc(10 * sizeof(char)); | ||||
13 | free(x); | ||||
14 | return x[5]; | ||||
15 | // CHECK: __asan_on_error called | ||||
16 | } |