From 3831352fa46fe363b4c0f952f71bb0daa47f9eec Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 26 Sep 2026 12:34:24 +0200 Subject: [PATCH] Misc: fixed strict aliasing violation in ImHashData(). (#9557) The SSE4.2 path read the input through an `ImU32` pointer but callers hash floats, pointers and structs. With clang 23 and LTO (such as `-O2 -msse4.2 -flto -fuse-ld=lld`) the float stores in `ImFontAtlasBakedGetId()` were optimized away, so every size of a font got the same `BakedId`. --- imgui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 57ed579af..a988ce6e0 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2493,7 +2493,7 @@ ImGuiID ImHashData(const void* data_p, size_t data_size, ImGuiID seed) #else while (data + 4 <= data_end) { - crc = _mm_crc32_u32(crc, *(ImU32*)data); + ImU32 v; memcpy(&v, data, sizeof(v)); crc = _mm_crc32_u32(crc, v); data += 4; } while (data < data_end)