• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cl_asan -O0 %s -Fe%t
2 // RUN: %run %t
3 
4 #include <windows.h>
5 #include <process.h>
6 
thread_proc(void *)7 unsigned WINAPI thread_proc(void *) {
8   volatile char stack_buffer[42];
9   for (int i = 0; i < sizeof(stack_buffer); ++i)
10     stack_buffer[i] = 42;
11   return 0;
12 }
13 
main()14 int main() {
15   HANDLE thr = (HANDLE)_beginthreadex(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   CloseHandle(thr);
21 }
22