From: Ivan Maidanski Date: Thu, 16 Feb 2012 18:47:28 +0000 (+0400) Subject: Fix GC_push_all/selected boundaries check X-Git-Tag: gc7_2~62 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=18ac0bc42770c1de127fb48fcd2fbc7d75752c17;p=gc Fix GC_push_all/selected boundaries check * mark.c (GC_push_all, GC_push_selected): Properly check for empty region after boundaries alignment (for the case when boundaries unaligned and the region is short than one word); simplify the checked condition. --- diff --git a/mark.c b/mark.c index 434bec76..41a7af52 100644 --- a/mark.c +++ b/mark.c @@ -1265,7 +1265,8 @@ GC_INNER void GC_push_all(ptr_t bottom, ptr_t top) bottom = (ptr_t)(((word) bottom + ALIGNMENT-1) & ~(ALIGNMENT-1)); top = (ptr_t)(((word) top) & ~(ALIGNMENT-1)); - if (top == 0 || bottom == top) return; + if (bottom >= top) return; + GC_mark_stack_top++; if (GC_mark_stack_top >= GC_mark_stack_limit) { ABORT("Unexpected mark stack overflow"); @@ -1296,7 +1297,7 @@ GC_INNER void GC_push_all(ptr_t bottom, ptr_t top) bottom = (ptr_t)(((word) bottom + ALIGNMENT-1) & ~(ALIGNMENT-1)); top = (ptr_t)(((word) top) & ~(ALIGNMENT-1)); - if (top == 0 || bottom == top) return; + if (bottom >= top) return; h = HBLKPTR(bottom + HBLKSIZE); if (top <= (ptr_t) h) {