1// RUN: %clang_cl_asan %Od %p/dll_host.cpp %Fe%t
2// RUN: %clang_cl_asan %LD %Od %s %Fe%t.dll
3// RUN: not %run %t %t.dll 2>&1 | FileCheck %s
4
5#include <process.h>
6
7void noreturn_f() {
8 int subscript = -1;
9 char buffer[42];
10 buffer[subscript] = 42;
11 _exit(1);
12// CHECK: AddressSanitizer: stack-buffer-underflow on address [[ADDR:0x[0-9a-f]+]]
13// CHECK: WRITE of size 1 at [[ADDR]] thread T0
14// CHECK-NEXT: noreturn_f{{.*}}dll_noreturn.cpp:[[@LINE-4]]
15// CHECK-NEXT: test_function{{.*}}dll_noreturn.cpp
16// CHECK-NEXT: main{{.*}}dll_host.cpp
17//
18// CHECK: Address [[ADDR]] is located in stack of thread T0 at offset [[OFFSET:.*]] in frame
19// CHECK-NEXT: noreturn_f{{.*}}dll_noreturn.cpp
20// CHECK: 'buffer'{{.*}} <== Memory access at offset [[OFFSET]] underflows this variable
21// CHECK-LABEL: SUMMARY
22}
23
24extern "C" __declspec(dllexport)
25int test_function() {
26 noreturn_f();
27 return 0;
28}
29

source code of compiler-rt/test/asan/TestCases/Windows/dll_noreturn.cpp