[Bug tree-optimization/83357] [Gcc-optimization] wrong code for elements in a union pointed by two different types of global pointers

yangyibiao at nju dot edu.cn gcc-bugzilla@gcc.gnu.org
Mon Dec 11 08:44:00 GMT 2017


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.


More information about the Gcc-bugs mailing list