1// RUN: %clang_cl_asan %Od %s %Fe%t
2// RUN: %run %t
3
4#include <windows.h>
5
6DWORD WINAPI thread_proc(void *) {
7 volatile char stack_buffer[42];
8 for (int i = 0; i < sizeof(stack_buffer); ++i)
9 stack_buffer[i] = 42;
10 return 0x42;
11}
12
13int main() {
14 DWORD exitcode;
15 HANDLE thr = CreateThread(NULL, 0, thread_proc, NULL, 0, NULL);
16 if (thr == 0)
17 return 1;
18 if (WAIT_OBJECT_0 != WaitForSingleObject(thr, INFINITE))
19 return 2;
20
21 GetExitCodeThread(thr, &exitcode);
22 if (exitcode != 0x42)
23 return 3;
24 CloseHandle(thr);
25}
26
27

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