This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/65892] gcc fails to implement N685 aliasing of union members
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 09 Sep 2015 14:42:41 +0000
- Subject: [Bug c/65892] gcc fails to implement N685 aliasing of union members
- Auto-submitted: auto-generated
- References: <bug-65892-4 at http dot gcc dot gnu dot org/bugzilla/>
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.