]> 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>
Fri, 11 Mar 2016 21:07:25 +0000 (00:07 +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 9df42da5b8a8fd2b81e8e7ab06d86b1b8d9fb047..f994a6243a74cc1ed53b9a65c0532957c359a028 100644 (file)
--- 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);
         }
     }