From 56af64dc1920c50d5cf7aee329b2bb1fe1d23519 Mon Sep 17 00:00:00 2001 From: Jason Evans Date: Wed, 12 Aug 2015 16:38:20 -0700 Subject: Fix a strict aliasing violation. --- src/chunk.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/chunk.c b/src/chunk.c index b5b8f0d..6ba1ca7 100644 --- a/src/chunk.c +++ b/src/chunk.c @@ -89,7 +89,12 @@ chunk_hooks_set(arena_t *arena, const chunk_hooks_t *chunk_hooks) * correctness, so they perform unlocked reads. */ #define ATOMIC_COPY_HOOK(n) do { \ - atomic_write_p((void **)&arena->chunk_hooks.n, chunk_hooks->n); \ + union { \ + chunk_##n##_t **n; \ + void **v; \ + } u; \ + u.n = &arena->chunk_hooks.n; \ + atomic_write_p(u.v, chunk_hooks->n); \ } while (0) ATOMIC_COPY_HOOK(alloc); ATOMIC_COPY_HOOK(dalloc); -- cgit v0.12