This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/57359] wrong code for union access at -O3 on x86_64-linux
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 04 Jun 2013 12:37:31 +0000
- Subject: [Bug tree-optimization/57359] wrong code for union access at -O3 on x86_64-linux
- Auto-submitted: auto-generated
- References: <bug-57359-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57359
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Status|RESOLVED |ASSIGNED
Component|rtl-optimization |tree-optimization
Resolution|INVALID |---
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
Note that the GIMPLE/RTL IL does not have all restrictions of C so even
if the testcase is invalid C the generated GIMPLE IL may be valid and thus
there may still be a bug in GCC. In particular the middle-end memory model
does not require the effective type change to go through a union type.
And indeed the bug is in store-motion which sinks *pll = a cross *pii = 0.
Replace u with anonymous storage and use placement-new to properly construct
a new type in it and get a valid C++ testcase that is miscompiled.
-fno-tree-loop-im fixes it.
I will have a look.