]> granicus.if.org Git - gc/commitdiff
Fix 'statement unreachable' compiler warning in memalign
authorIvan Maidanski <ivmai@mail.ru>
Tue, 1 Mar 2016 21:11:22 +0000 (00:11 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 1 Mar 2016 21:11:22 +0000 (00:11 +0300)
* 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.

mallocx.c

index 75147486f0a8d822ee5a7fb321a40a6464c237c2..f758bf8b5257dd4f99586af61c61687d7903d6df 100644 (file)
--- a/mallocx.c
+++ b/mallocx.c
@@ -485,7 +485,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);
         }
     }