https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116672
--- Comment #5 from Xi Ruoyao <xry111 at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #4) > Note GCC has an (I think undocumented) exception to the aliasing rule where > `void*` is allowed to alias all other pointer types in a similar fashion as > `char` does. I don't think it's an exception, just some coincidence. "Chains of casts" like (float *)(void *)(int *) is still broken (PR 112409 is an invalid PR about it). And if GCC can only figure out a chain ending in (void *) like (float *)(int *)(void *), it means GCC do not know the original object type and cannot do TBAA. With more optimizations (like LTO) GCC may extend the chain to something like (float *)(int *)(void *)(int *) and figure out the aliasing violation & optimize something away.