aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2025-07-10 16:42:47 -0600
committerRichard Henderson <richard.henderson@linaro.org>2025-07-11 10:43:47 -0600
commitc86da2b1dd7589d414b5a2d1e5361d6c3b4ca885 (patch)
tree94f746cd10570d087693b329c4989106dce478d0 /include
parente4e839b2eeea5745c48ce47144c7842eb7cd455f (diff)
downloadqemu-c86da2b1dd7589d414b5a2d1e5361d6c3b4ca885.zip
qemu-c86da2b1dd7589d414b5a2d1e5361d6c3b4ca885.tar.gz
qemu-c86da2b1dd7589d414b5a2d1e5361d6c3b4ca885.tar.bz2
tcg: Use uintptr_t in tcg_malloc implementation
Avoid ubsan failure with clang-20, tcg.h:715:19: runtime error: applying non-zero offset 64 to null pointer by not using pointers. Acked-by: Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/tcg/tcg.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
index 125323f..0c2a319 100644
--- a/include/tcg/tcg.h
+++ b/include/tcg/tcg.h
@@ -357,7 +357,7 @@ static inline TCGRegSet output_pref(const TCGOp *op, unsigned i)
}
struct TCGContext {
- uint8_t *pool_cur, *pool_end;
+ uintptr_t pool_cur, pool_end;
TCGPool *pool_first, *pool_current, *pool_first_large;
int nb_labels;
int nb_globals;
@@ -706,7 +706,7 @@ size_t tcg_nb_tbs(void);
static inline void *tcg_malloc(int size)
{
TCGContext *s = tcg_ctx;
- uint8_t *ptr, *ptr_end;
+ uintptr_t ptr, ptr_end;
/* ??? This is a weak placeholder for minimum malloc alignment. */
size = QEMU_ALIGN_UP(size, 8);
@@ -717,7 +717,7 @@ static inline void *tcg_malloc(int size)
return tcg_malloc_internal(tcg_ctx, size);
} else {
s->pool_cur = ptr_end;
- return ptr;
+ return (void *)ptr;
}
}