From: Ivan Maidanski Date: Mon, 28 Dec 2015 14:49:54 +0000 (+0300) Subject: Workaround 'comparison is always false' GCC warning in GC_FAST_MALLOC_GRANS X-Git-Tag: gc7_4_4~57 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9b7dd43f00cb495297f40992a147424b45e2205c;p=gc Workaround 'comparison is always false' GCC warning in GC_FAST_MALLOC_GRANS * include/gc_inline.h (GC_FAST_MALLOC_GRANS): Refactoring of condition expression for entry containing counter or is NULL to avoid "comparison of unsigned expression < 0 is always false" warning reported by GCC. --- diff --git a/include/gc_inline.h b/include/gc_inline.h index 8d93f44a..90a7a761 100644 --- a/include/gc_inline.h +++ b/include/gc_inline.h @@ -79,7 +79,7 @@ GC_API void GC_CALL GC_generic_malloc_many(size_t /* lb */, int /* k */, while (GC_EXPECT((GC_word)my_entry \ <= (num_direct) + GC_TINY_FREELISTS + 1, 0)) { \ /* Entry contains counter or NULL */ \ - if ((GC_word)my_entry - 1 < (num_direct)) { \ + if ((GC_word)my_entry <= (num_direct) && my_entry != 0) { \ /* Small counter value, not NULL */ \ *my_fl = (char *)my_entry + (granules) + 1; \ result = (default_expr); \