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 tree-optimization/57359] wrong code for union access at -O3 on x86_64-linux


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.


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