]> granicus.if.org Git - gc/commitdiff
Fix type of local variables receiving result of PHT_HASH
authorIvan Maidanski <ivmai@mail.ru>
Thu, 22 Feb 2018 20:39:38 +0000 (23:39 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 2 Mar 2018 16:58:01 +0000 (19:58 +0300)
(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.

os_dep.c

index d3429d047d6ebb93ef4da535db1253756fb39ba5..a5bcd6ed5e265db72d3c167668b077bb451d658a 100644 (file)
--- 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) {