[LVI] Add trunc to i1 handling. (#124480)
[llvm-project.git] / compiler-rt / test / asan / TestCases / Windows / thread_suspended.cpp
blob7b832e1130378b1ed2251496d93cd217f4706d75
1 // RUN: %clang_cl_asan %Od %s %Fe%t
2 // RUN: %run %t
4 #include <windows.h>
6 DWORD 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;
13 int main() {
14 DWORD exitcode;
15 HANDLE thr = CreateThread(NULL, 0, thread_proc, NULL, CREATE_SUSPENDED, NULL);
16 ResumeThread(thr);
17 if (thr == 0)
18 return 1;
19 if (WAIT_OBJECT_0 != WaitForSingleObject(thr, INFINITE))
20 return 2;
22 GetExitCodeThread(thr, &exitcode);
23 if (exitcode != 0x42)
24 return 3;
25 CloseHandle(thr);