brintos

brintos / llvm-project-archived public Read only

0
0
Text · 472 B · 39b9358 Raw
22 lines · cpp
1// RUN: %clang_cl_asan %Od %s %Fe%t2// RUN: %run %t3 4#include <windows.h>5#include <process.h>6 7unsigned 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 14int 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