From c20dc069cd2e575a1c9d1b3a932a513a159bd4c7 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Wed, 2 Mar 2016 00:11:22 +0300 Subject: [PATCH] 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. --- mallocx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mallocx.c b/mallocx.c index 75147486..f758bf8b 100644 --- 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); } } -- 2.40.0