aboutsummaryrefslogtreecommitdiff
path: root/test/asan/TestCases/Windows/on_error_callback.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/asan/TestCases/Windows/on_error_callback.cc')
-rw-r--r--test/asan/TestCases/Windows/on_error_callback.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/asan/TestCases/Windows/on_error_callback.cc b/test/asan/TestCases/Windows/on_error_callback.cc
new file mode 100644
index 000000000000..9e690a342b56
--- /dev/null
+++ b/test/asan/TestCases/Windows/on_error_callback.cc
@@ -0,0 +1,20 @@
+// RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s
+
+// FIXME: merge this with the common on_error_callback test when we can run
+// common tests on Windows.
+
+#include <stdio.h>
+#include <stdlib.h>
+
+extern "C"
+void __asan_on_error() {
+ fprintf(stderr, "__asan_on_error called");
+ fflush(0);
+}
+
+int main() {
+ char *x = (char*)malloc(10 * sizeof(char));
+ free(x);
+ return x[5];
+ // CHECK: __asan_on_error called
+}