1// RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s
2
3// FIXME: merge this with the common on_error_callback test when we can run
4// common tests on Windows.
5
6#include <stdio.h>
7#include <stdlib.h>
8
9extern "C"
10void __asan_on_error() {
11  fprintf(stderr, "__asan_on_error called");
12  fflush(0);
13}
14
15int main() {
16  char *x = (char*)malloc(10 * sizeof(char));
17  free(x);
18  return x[5];
19  // CHECK: __asan_on_error called
20}
21