[Bug c/65892] gcc fails to implement N685 aliasing of union members
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Sep 9 14:42:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65892
--- Comment #16 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Message [c++std-core-20893] on the C++ core reflector on 2011-12-14 supports
the GCC view that a C++ compiler can apply strict aliasing rules to p1->m and
p2->m unless the fact they come from the same object is visible to the
compiler.
<quote>
| Either I'm mistaken, or it is a 'magical property of unions'. If the
| compiler can figure out two objects didn't come form the same union,
| it can assume they do not alias,
Yes. I believe I filled a core issue regarding this -- coming from
controversy originating from optimizations performed by compilers
today (especially without full program analysis) -- and the resolution
is that if intend to play type punning games with X and Y you better let
the type checker and optimizer see your cards upfront. Otherwise, you
are on your own. I can't remember the issue number right now. In the
end, I think that was the right decision.
</quote>
But I can't find the core issue referred to.
More information about the Gcc-bugs
mailing list