From: Ivan Maidanski Date: Wed, 17 Feb 2016 07:54:31 +0000 (+0300) Subject: Fix 'statement unreachable' compiler warning in GC_mark_from X-Git-Tag: gc7_4_4~29 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3c4dce77dc4b225cca216ac513a04d999e81aee5;p=gc Fix 'statement unreachable' compiler warning in GC_mark_from * mark.c (GC_mark_from): Initialize 'limit' local variable unconditionally; add static assertion on GC_DS_TAGS (to check that it corresponds to number of switch cases); remove switch default (as it cannot happen). --- diff --git a/mark.c b/mark.c index 5cb3fede..effe7650 100644 --- a/mark.c +++ b/mark.c @@ -609,9 +609,9 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack, mse *mark_stack_limit) { signed_word credit = HBLKSIZE; /* Remaining credit for marking work */ - ptr_t current_p; /* Pointer to current candidate ptr. */ - word current; /* Candidate pointer. */ - ptr_t limit; /* (Incl) limit of current candidate range. */ + ptr_t current_p; /* Pointer to current candidate ptr. */ + word current; /* Candidate pointer. */ + ptr_t limit = 0; /* (Incl) limit of current candidate range. */ word descr; ptr_t greatest_ha = GC_greatest_plausible_heap_addr; ptr_t least_ha = GC_least_plausible_heap_addr; @@ -638,6 +638,7 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack, if (descr & ((~(WORDS_TO_BYTES(SPLIT_RANGE_WORDS) - 1)) | GC_DS_TAGS)) { word tag = descr & GC_DS_TAGS; + GC_STATIC_ASSERT(GC_DS_TAGS == 0x3); switch(tag) { case GC_DS_LENGTH: /* Large length. */ @@ -769,9 +770,6 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack, continue; } goto retry; - default: - limit = 0; /* initialized to prevent warning. */ - ABORT_RET("GC_mark_from: bad state"); } } else /* Small object with length descriptor */ { mark_stack_top--;