1 // RUN: %clang_cl_asan -O0 %s -Fe%t
2 // RUN: %run %t
3 
4 #include <windows.h>
5 
thread_proc_1(void *)6 DWORD WINAPI thread_proc_1(void *) {
7   volatile int x, y, z;
8   x = 1;
9   y = 2;
10   z = 3;
11   return 0;
12 }
13 
thread_proc_2(void *)14 DWORD WINAPI thread_proc_2(void *) {
15   volatile char stack_buffer[42];
16   for (int i = 0; i < sizeof(stack_buffer); ++i)
17     stack_buffer[i] = 42;
18   return 0;
19 }
20 
main(void)21 int main(void) {
22   HANDLE thr = NULL;
23 
24   thr = CreateThread(NULL, 0, thread_proc_1, NULL, 0, NULL);
25   if (thr == 0)
26     return 1;
27   if (WAIT_OBJECT_0 != WaitForSingleObject(thr, INFINITE))
28     return 2;
29 
30   thr = CreateThread(NULL, 0, thread_proc_2, NULL, 0, NULL);
31   if (thr == 0)
32     return 3;
33   if (WAIT_OBJECT_0 != WaitForSingleObject(thr, INFINITE))
34     return 4;
35   CloseHandle(thr);
36 }
37 
38