From: Ivan Maidanski Date: Tue, 1 Mar 2016 21:11:22 +0000 (+0300) Subject: Fix 'statement unreachable' compiler warning in memalign X-Git-Tag: gc7_4_4~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7ef92c41b4b107a6ec71141a1491742f7eae3541;p=gc Fix 'statement unreachable' compiler warning in memalign * mallocx.c (GC_memalign): Do not handle case of offset >= VALID_OFFSET_SZ; add assertion for offset; add static assertion for VALID_OFFSET_SZ value. --- diff --git a/mallocx.c b/mallocx.c index 9df42da5..f994a624 100644 --- a/mallocx.c +++ b/mallocx.c @@ -472,7 +472,8 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_memalign(size_t align, size_t lb) if (offset != 0) { offset = align - offset; if (!GC_all_interior_pointers) { - if (offset >= VALID_OFFSET_SZ) return GC_malloc(HBLKSIZE); + GC_STATIC_ASSERT(VALID_OFFSET_SZ <= HBLKSIZE); + GC_ASSERT(offset < VALID_OFFSET_SZ); GC_register_displacement(offset); } }