Equivalent to
https://gitlab.nic.cz/knot/knot-dns/-/commit/
27825e4c595d952
The problem happens now with clang 20.
I don't think I've seen it happen with GCC 15
or with some earlier clang versions.
mm->free = free;
}
+// UBSAN type punning workaround
+static void *mp_alloc_wrap(void *ctx, size_t size)
+{
+ return mp_alloc(ctx, size);
+}
+
void mm_ctx_mempool(knot_mm_t *mm, size_t chunk_size)
{
mm->ctx = mp_new(chunk_size);
- mm->alloc = (knot_mm_alloc_t)mp_alloc;
+ mm->alloc = mp_alloc_wrap;
mm->free = mm_nofree;
}