instead of undefined cases from casting uintptr_t into intptr_t.
---
 malloc/malloc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/malloc/malloc.c b/malloc/malloc.c
index 444dc61825..18ef6b5cb8 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -3150,7 +3150,8 @@ tcache_key_initialize (void)
   int minimum_bits = __WORDSIZE / 4;
   int maximum_bits = __WORDSIZE - minimum_bits;
 
-  while (labs ((intptr_t) tcache_key) <= 0x1000000
+  while (tcache_key <= 0x1000000
+      || tcache_key >= ((uintptr_t) ULONG_MAX) - 0x1000000
       || stdc_count_ones (tcache_key) < minimum_bits
       || stdc_count_ones (tcache_key) > maximum_bits)
     {
-- 
2.51.0


Reply via email to