From: Ivan Maidanski Date: Wed, 20 Jun 2018 08:35:55 +0000 (+0300) Subject: Add missing type casts in remap and register_my_thread_inner X-Git-Tag: v8.0.0~103 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b66a887d77e6294691ebf51628f87c15820aaf0c;p=gc Add missing type casts in remap and register_my_thread_inner (fix of commit a825a2d) Issue #206 (bdwgc). * os_dep.c [USE_MUNMAP && USE_WINALLOC] (GC_remap): Cast result of VirtualAlloc to ptr_t. * win32_threads.c [!GC_NO_THREADS_DISCOVERY] (GC_register_my_thread_inner): Cast the first argument of InterlockedExchange() call to word* (instead of void*). --- diff --git a/os_dep.c b/os_dep.c index c24d28e3..3a531955 100644 --- a/os_dep.c +++ b/os_dep.c @@ -2603,9 +2603,10 @@ GC_INNER void GC_remap(ptr_t start, size_t bytes) != sizeof(mem_info)) ABORT("Weird VirtualQuery result"); alloc_len = (len < mem_info.RegionSize) ? len : mem_info.RegionSize; - result = VirtualAlloc(start_addr, alloc_len, MEM_COMMIT, - GC_pages_executable ? PAGE_EXECUTE_READWRITE : - PAGE_READWRITE); + result = (ptr_t)VirtualAlloc(start_addr, alloc_len, MEM_COMMIT, + GC_pages_executable + ? PAGE_EXECUTE_READWRITE + : PAGE_READWRITE); if (result != start_addr) { if (GetLastError() == ERROR_NOT_ENOUGH_MEMORY || GetLastError() == ERROR_OUTOFMEMORY) { diff --git a/win32_threads.c b/win32_threads.c index 5ff66f22..e0cc09a3 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -417,7 +417,7 @@ STATIC GC_thread GC_register_my_thread_inner(const struct GC_stack_base *sb, /* variants. */ /* cast away volatile qualifier */ for (i = 0; - InterlockedExchange((void*)&dll_thread_table[i].tm.in_use, 1) != 0; + InterlockedExchange((word*)&dll_thread_table[i].tm.in_use, 1) != 0; i++) { /* Compare-and-swap would make this cleaner, but that's not */ /* supported before Windows 98 and NT 4.0. In Windows 2000, */