From a92b5c847c9c745e118580377af6105951a8d92f Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Thu, 16 Feb 2012 22:47:28 +0400 Subject: [PATCH] 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. --- mark.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mark.c b/mark.c index 15e570af..62e38137 100644 --- a/mark.c +++ b/mark.c @@ -1260,7 +1260,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"); @@ -1291,7 +1292,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) { -- 2.40.0