]> git.proxmox.com Git - rustc.git/blob - src/libcompiler_builtins/compiler-rt/test/asan/TestCases/Windows/dll_null_deref.cc
New upstream version 1.20.0+dfsg1
[rustc.git] / src / libcompiler_builtins / compiler-rt / test / asan / TestCases / Windows / dll_null_deref.cc
1 // RUN: %clang_cl_asan -O0 %p/dll_host.cc -Fe%t
2 // RUN: %clang_cl_asan -LD -O0 %s -Fe%t.dll
3 // RUN: not %run %t %t.dll 2>&1 | FileCheck %s
4
5 __attribute__((noinline))
6 static void NullDeref(int *ptr) {
7 // CHECK: ERROR: AddressSanitizer: access-violation on unknown address
8 // CHECK: {{0x0*000.. .*pc 0x.*}}
9 ptr[10]++; // BOOM
10 }
11
12 extern "C" __declspec(dllexport)
13 int test_function() {
14 NullDeref((int*)0);
15 // CHECK: {{ #1 0x.* in test_function .*\dll_null_deref.cc:}}[[@LINE-1]]
16 // CHECK: AddressSanitizer can not provide additional info.
17 return 0;
18 }