public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/39604]  New: tree-ssa-sink breaks stack layout
@ 2009-03-31 22:36 sandra at codesourcery dot com
  2009-03-31 22:38 ` [Bug middle-end/39604] " sandra at codesourcery dot com
                   ` (24 more replies)
  0 siblings, 25 replies; 27+ messages in thread
From: sandra at codesourcery dot com @ 2009-03-31 22:36 UTC (permalink / raw)
  To: gcc-bugs

As reported in this thread:

http://gcc.gnu.org/ml/gcc-patches/2009-03/msg01798.html

This problem was reported by an ARM user and reproduced on arm-none-eabi, but
is not target-specific.

If the attached test program is compiled with -O1, it fails by incorrectly
calling a pure virtual method.  What is happening is that tree-ssa-sink is
moving code from the inlined destructor for STUFF, in the first nested block,
into the second nested block, where it ends up after the code for the inlined
constructor for STUFF2.  Then, cfgexpand comes along and decides that STUFF and
STUFF2 can share stack space because they are in disjoint lexical blocks.  Thus
the sunk destructor statement for STUFF ends up trashing the vtable of STUFF2. 
The test program appears to work correctly at -O2 only because
-fstrict-aliasing prevents cfgexpand from assigning STUFF and STUFF2 to the
same stack offset.

Per further discussion in the thread above, cfgexpand's stack layout should not
be using lexical block scoping information to determine when stack variables
may share storage, as GIMPLE lowering removes lexical scopes and promotes all
locals to function scope, and subsequent middle-end optimizations do not
preserve the lexical block structure.  Since stack variable sharing is an
important optimization for some applications, some other form of lifetime
analysis is needed.

Apparently PR middle-end/32327 was another incarnation of this same problem,
but was closed without really addressing it.


-- 
           Summary: tree-ssa-sink breaks stack layout
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sandra at codesourcery dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: arm-none-eabi


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39604


^ permalink raw reply	[flat|nested] 27+ messages in thread
[parent not found: <bug-39604-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2011-06-01 17:35 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-31 22:36 [Bug middle-end/39604] New: tree-ssa-sink breaks stack layout sandra at codesourcery dot com
2009-03-31 22:38 ` [Bug middle-end/39604] " sandra at codesourcery dot com
2009-03-31 23:47 ` [Bug tree-optimization/39604] [4.3/4.4/4.5 Regression] " pinskia at gcc dot gnu dot org
2009-04-01  8:42 ` rguenth at gcc dot gnu dot org
2009-04-01 11:45 ` matz at gcc dot gnu dot org
2009-04-01 14:00 ` jakub at gcc dot gnu dot org
2009-04-01 14:05 ` matz at gcc dot gnu dot org
2009-04-01 14:10 ` rguenther at suse dot de
2009-04-01 14:16 ` jakub at gcc dot gnu dot org
2009-04-01 14:29 ` rguenther at suse dot de
2009-04-01 14:47 ` matz at gcc dot gnu dot org
2009-04-03 12:54 ` sandra at codesourcery dot com
2009-04-03 13:23 ` rguenther at suse dot de
2009-04-14  9:49 ` jakub at gcc dot gnu dot org
2009-05-09  1:21 ` dougkwan at google dot com
2009-05-10  0:56 ` dougkwan at google dot com
2009-05-10  2:10 ` matz at gcc dot gnu dot org
2009-05-10 10:00 ` rguenth at gcc dot gnu dot org
2009-05-10 13:51 ` steven at gcc dot gnu dot org
2009-05-10 14:14 ` rguenther at suse dot de
2009-05-10 14:23 ` steven at gcc dot gnu dot org
2009-05-10 14:32 ` rguenther at suse dot de
2009-08-04 12:48 ` rguenth at gcc dot gnu dot org
2009-09-18  7:19 ` ramana at gcc dot gnu dot org
2009-12-16 20:53 ` rguenth at gcc dot gnu dot org
2010-03-08 22:50 ` pinskia at gcc dot gnu dot org
     [not found] <bug-39604-4@http.gcc.gnu.org/bugzilla/>
2011-06-01 17:35 ` sandra at codesourcery dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).