summaryrefslogtreecommitdiff
path: root/win32_threads.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-12-12 09:26:11 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-12-12 11:26:53 +0300
commite45120d08bd1b4dcc2184024e76b40ddfafc69ca (patch)
treea7ddb51478ae3d82514dee70e945c6e4d489628e /win32_threads.c
parent67d97009f8af7bb3fcf1a3eea68480a4fcdb3df4 (diff)
downloadbdwgc-e45120d08bd1b4dcc2184024e76b40ddfafc69ca.tar.gz
Eliminate code defect of volatile read in assertion in Win32 GC_start_world
(fix of commit 7eb49a4e6) Issue #362 (bdwgc). * win32_threads.c (GC_start_world): Cast away volatile for crtn->stack_end in the assertions.
Diffstat (limited to 'win32_threads.c')
-rw-r--r--win32_threads.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/win32_threads.c b/win32_threads.c
index c5eb9a24..9ff9dfdb 100644
--- a/win32_threads.c
+++ b/win32_threads.c
@@ -575,7 +575,8 @@ GC_INNER void GC_start_world(void)
# ifdef DEBUG_THREADS
GC_log_printf("Resuming 0x%x\n", (int)p->id);
# endif
- GC_ASSERT(p -> crtn -> stack_end != NULL && p -> id != self_id);
+ GC_ASSERT(p -> id != self_id
+ && *(/* no volatile */ ptr_t *)&(p -> crtn -> stack_end) != NULL);
if (ResumeThread(THREAD_HANDLE(p)) == (DWORD)-1)
ABORT("ResumeThread failed");
p -> flags &= ~IS_SUSPENDED;
@@ -594,7 +595,8 @@ GC_INNER void GC_start_world(void)
# ifdef DEBUG_THREADS
GC_log_printf("Resuming 0x%x\n", (int)p->id);
# endif
- GC_ASSERT(p -> crtn -> stack_end != NULL && p -> id != self_id);
+ GC_ASSERT(p -> id != self_id
+ && *(ptr_t *)&(p -> crtn -> stack_end) != NULL);
if (ResumeThread(THREAD_HANDLE(p)) == (DWORD)-1)
ABORT("ResumeThread failed");
GC_win32_unprotect_thread(p);