public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sandra at codesourcery dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/39604]  New: tree-ssa-sink breaks stack layout
Date: Tue, 31 Mar 2009 22:36:00 -0000	[thread overview]
Message-ID: <bug-39604-14095@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2009-03-31 22:36 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-31 22:36 sandra at codesourcery dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-39604-14095@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).