From: Ivan Maidanski Date: Thu, 22 Feb 2018 20:39:38 +0000 (+0300) Subject: Fix type of local variables receiving result of PHT_HASH X-Git-Tag: v7.6.6~37 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e7401008e06fc17aac73ee0b40c91288ee7e62d3;p=gc Fix type of local variables receiving result of PHT_HASH (back-port of commit 037991eb from 'master') The variables should be of word type, not int or size_t. * os_dep.c (GC_write_fault_handler, GC_remove_protection): Change type of index local variable from size_t to word. * os_dep.c [MPROTECT_VDB && DARWIN] (catch_exception_raise): Change type of index local variable from int to word. --- diff --git a/os_dep.c b/os_dep.c index d3429d04..a5bcd6ed 100644 --- a/os_dep.c +++ b/os_dep.c @@ -3301,7 +3301,7 @@ GC_API GC_push_other_roots_proc GC_CALL GC_get_push_other_roots(void) /* and then to have the thread stopping code set the dirty */ /* flag, if necessary. */ for (i = 0; i < divHBLKSZ(GC_page_size); i++) { - size_t index = PHT_HASH(h+i); + word index = PHT_HASH(h+i); async_set_pht_entry_from_index(GC_dirty_pages, index); } @@ -3355,7 +3355,8 @@ GC_INNER void GC_remove_protection(struct hblk *h, word nblocks, return; } for (current = h_trunc; (word)current < (word)h_end; ++current) { - size_t index = PHT_HASH(current); + word index = PHT_HASH(current); + if (!is_ptrfree || (word)current < (word)h || (word)current >= (word)(h + nblocks)) { async_set_pht_entry_from_index(GC_dirty_pages, index); @@ -4350,7 +4351,7 @@ catch_exception_raise(mach_port_t exception_port GC_ATTR_UNUSED, UNPROTECT(h, GC_page_size); for (i = 0; i < divHBLKSZ(GC_page_size); i++) { - register int index = PHT_HASH(h+i); + word index = PHT_HASH(h+i); async_set_pht_entry_from_index(GC_dirty_pages, index); } } else if (GC_mprotect_state == GC_MP_DISCARDING) {