https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83357
--- Comment #3 from Yibiao Yang <yangyibiao at nju dot edu.cn> --- Thank you very much. (In reply to Jakub Jelinek from comment #2) > 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.