summaryrefslogtreecommitdiff
path: root/test/asan/TestCases/Windows/null_deref.cc
diff options
context:
space:
mode:
authorTimur Iskhodzhanov <timurrrr@google.com>2014-07-11 11:57:41 +0000
committerTimur Iskhodzhanov <timurrrr@google.com>2014-07-11 11:57:41 +0000
commit65b42e13c28dfc17859db3ba78dc0a4e2a35cb9c (patch)
tree448277709f6a531c8f6ecdba654454b9e3874212 /test/asan/TestCases/Windows/null_deref.cc
parent4f59148e575e01ed1896ff98f0e8a99ab689ebe5 (diff)
[ASan/Win] Catch NULL derefs and page faults
Reviewed at http://reviews.llvm.org/D4471 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@212807 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/asan/TestCases/Windows/null_deref.cc')
-rw-r--r--test/asan/TestCases/Windows/null_deref.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/asan/TestCases/Windows/null_deref.cc b/test/asan/TestCases/Windows/null_deref.cc
new file mode 100644
index 000000000..42172109d
--- /dev/null
+++ b/test/asan/TestCases/Windows/null_deref.cc
@@ -0,0 +1,15 @@
+// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
+// FIXME: merge this with the common null_deref test when we can run common
+// tests on Windows.
+
+__attribute__((noinline))
+static void NullDeref(int *ptr) {
+ // CHECK: ERROR: AddressSanitizer: access-violation on unknown address
+ // CHECK: {{0x0*000.. .*pc 0x.*}}
+ ptr[10]++; // BOOM
+}
+int main() {
+ NullDeref((int*)0);
+ // CHECK: {{ #1 0x.* in main.*null_deref.cc:}}[[@LINE-1]]
+ // CHECK: {{AddressSanitizer can not provide additional info.}}
+}