From b4330b02a8a909aed71c46d2c661d69545628fb4 Mon Sep 17 00:00:00 2001 From: Jason Evans Date: Fri, 4 Sep 2015 10:31:41 -0700 Subject: [PATCH] Fix pointer comparision with undefined behavior. This didn't cause bad code generation in the one case spot-checked (gcc 4.8.1), but had the potential to to so. This bug was introduced by 594c759f37c301d0245dc2accf4d4aaf9d202819 (Optimize arena_prof_tctx_set().). --- include/jemalloc/internal/arena.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/jemalloc/internal/arena.h b/include/jemalloc/internal/arena.h index 76c5b936..4c1a471a 100644 --- a/include/jemalloc/internal/arena.h +++ b/include/jemalloc/internal/arena.h @@ -1105,8 +1105,8 @@ arena_prof_tctx_set(const void *ptr, size_t usize, prof_tctx_t *tctx) assert(arena_mapbits_allocated_get(chunk, pageind) != 0); - if (unlikely(usize > SMALL_MAXCLASS || tctx > - (prof_tctx_t *)(uintptr_t)1U)) { + if (unlikely(usize > SMALL_MAXCLASS || (uintptr_t)tctx > + (uintptr_t)1U)) { arena_chunk_map_misc_t *elm; assert(arena_mapbits_large_get(chunk, pageind) != 0);