https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83357
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |jakub at gcc dot gnu.org Resolution|--- |INVALID --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- There is UB in that code, but the bug isn't about alignment, but about aliasing; the standard says that writing to a union member invalidates all other union members, and while GCC and other compilers as an extension allow that, the requirement is that the union is visible in the access path, which is not the case here. Testcases like this would almost always kill all the type based alias analysis optimizations. The fact that neither GCC nor clang -fsanitize=undefined catches this is just because there is no alias analysis sanitizer yet.