This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/65892] gcc fails to implement N685 aliasing of union members


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]