From 65ccc231df45e258421e2da78b4a15123da95505 Mon Sep 17 00:00:00 2001 From: foreman Date: Thu, 11 Dec 2014 13:28:22 -0500 Subject: [PATCH] P4 to Git Change 1104653 by jsjodin@jsjodin_linux_avx_hsa on 2014/12/11 13:21:54 EPR #411189 - Fix windows handling of SIGFPE. We cannot check worker thread during creation, because the constructor has not yet been called. Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/os/os_win32.cpp#43 edit [ROCm/clr commit: 5a2d6ed3c7f050e0b196021d9780e5516b1ca5bb] --- projects/clr/rocclr/runtime/os/os_win32.cpp | 26 +++++++++------------ 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/projects/clr/rocclr/runtime/os/os_win32.cpp b/projects/clr/rocclr/runtime/os/os_win32.cpp index 1b1bb0faff..a382dfb6eb 100644 --- a/projects/clr/rocclr/runtime/os/os_win32.cpp +++ b/projects/clr/rocclr/runtime/os/os_win32.cpp @@ -450,9 +450,9 @@ divExceptionFilter(struct _EXCEPTION_POINTERS* ep) { DWORD code = ep->ExceptionRecord->ExceptionCode; - if (code == EXCEPTION_INT_DIVIDE_BY_ZERO || - code == EXCEPTION_INT_OVERFLOW) { - + if ((code == EXCEPTION_INT_DIVIDE_BY_ZERO || + code == EXCEPTION_INT_OVERFLOW) && + Thread::current()->isWorkerThread()) { address insn = (address)ep->ContextRecord->LP64_SWITCH(Eip,Rip); if (Os::skipIDIV(insn)) { @@ -468,20 +468,16 @@ Thread::entry(Thread* thread) { void* ret = NULL; #if !defined(_WIN64) - if (thread->isWorkerThread()) { - __try { - ret = thread->main(); - } - __except(divExceptionFilter(GetExceptionInformation())) { - // nothing to do here. - } - } - else { -#else // _WIN64 - { -#endif // _WIN64 + __try { ret = thread->main(); } + __except(divExceptionFilter(GetExceptionInformation())) { + // nothing to do here. + } +#else // _WIN64 + ret = thread->main(); +#endif // _WIN64 + // The current thread exits, thus clear the pointer #if defined(USE_DECLSPEC_THREAD) details::thread_ = NULL;