public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jim Wilson <wilson@cygnus.com>
To: Mark Mitchell <mark@codesourcery.com>
Cc: gcc@gcc.gnu.org
Subject: Re: Bootstrap failure of gcc-ss-20010409 in ia64
Date: Mon, 16 Apr 2001 15:39:00 -0000	[thread overview]
Message-ID: <200104162239.PAA13601@wilson.cygnus.com> (raw)
In-Reply-To: <200104140901.CAA05718@wilson.cygnus.com>

>a) We generate a M_refcopy function that contains a __exception_info variable.
>   We inline this into another function, generating an exception_info var
>   with an abstract origin pointing back to us.  We then optimize and emit
>   M_refcopy, and in the process of doing so, the block tree is modified such
>   that the exception_info variable no longer exists.  We then later try to
>   emit debug info for the inlinee, and we find a decl whose abstract origin
>   no longer exists.  This problem does not exist with the RTL inliner, because
>   we make a copy of the inline function before optimizing and emitting it,
>   and hence all abstract origin pointers back to us remain valid.

I have now verified that this is true.

When we get to M_refcopy, the C++ front end generates an AST which is saved
in DECL_SAVED_TREE.  This contains an __exception_info variable.  We then
generate BLOCK trees and RTL from the AST, putting the block trees in
DECL_INITIAL.  At this point, the block trees contain an __exception_info
variable.  We then optimize and emit the M_refcopy function.  The optimizer
function reorder_basic_blocks massages the RTL and block tree.  At this
point, there is no longer any __exception_info variable.  We then emit
assembly language and debug info for M_refcopy.

Later, we inline the M_refcopy function into the M_grab function.  The
tree inliner in the C++ front end uses the DECL_SAVED_TREE for this.
The DECL_SAVED_TREE still contains references to an __exception_info
variable, so we end up with one inlined into M_grab, whose abstract origin
points back to M_refcopy.  When we later emit debug info for M_grab (actually
in my case, another function that M_grab was inlined into), we follow the
abstract origin pointer back to M_refcopy, but there is no __exception_info
variable in M_refcopy, and we abort.

So the problem here is that a function only has one block tree, but we
really need two, one for the abstract instance, and one for the concrete
out-of-line instance (to use dwarf2 terminology).

This wasn't a problem with the older RTL inliner for a couple of reasons
that I can see.  Firstly, we only had one representation for a function,
the block trees and the RTL.  If we optimized a function, and then later
used the optimized block tree/RTL for inlining, then everything remains
consistent.  Now however we have two representations for a function, the
AST in DECL_SAVED_TREE, and the block tree/RTL.  After optimization, these
are no longer consistent with each other.  Secondly, the RTL inliner would
make copies of the block tree before optimizing a function in some instance,
and this ensured that the original abstract instance block trees survived
for use by the debug output routines.

I see of couple of different ways to fix this.  We could try to make the
dwarf2out.c file use the DECL_SAVED_TREE instead of the block tree when
emitting debug info for an abstract instance.  This info is not in the
form that we want it, and hence this will require writing a bit of code.
Another possible solution is to modify the FUNCTION_DECL tree to have
two block trees, the original one created by the front ends, and an optimized
one.  When emitting debug info for an abstract instance, we use the original
block tree.  When emitting debug info for a concrete out-of-line instance,
we use the optimized block tree.  Both of these solutions will require
writing some non-trivial code and then debugging and testing it.

Possible simpler solutions, which may not be desirable, are turning the
RTL inliner back on, and disabling optimization passes that can delete blocks
from the block tree (e.g. -freorder-blocks).

Jim

  parent reply	other threads:[~2001-04-16 15:39 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-11  6:56 Andreas Schwab
2001-04-11 12:47 ` Jim Wilson
2001-04-11 17:31   ` Mark Mitchell
2001-04-11 17:43   ` Mark Mitchell
2001-04-11 18:28     ` Daniel Berlin
2001-04-11 18:34       ` Mark Mitchell
2001-04-11 20:24         ` Daniel Berlin
2001-04-11 21:19           ` Mark Mitchell
2001-04-11 21:36             ` Daniel Berlin
2001-04-12 12:27               ` Bill Nottingham
2001-04-12 15:03                 ` Daniel Berlin
2001-04-12 21:07                   ` Bill Nottingham
2001-04-12 21:46                     ` Daniel Berlin
2001-04-12 13:04             ` Jim Wilson
2001-04-12 15:06               ` Daniel Berlin
2001-04-13  8:49           ` Andreas Schwab
2001-04-13 10:04             ` Daniel Berlin
2001-04-13 10:23               ` Andreas Schwab
2001-04-13 12:20                 ` Daniel Berlin
2001-04-13 12:39                   ` Andreas Schwab
2001-04-13 12:56                     ` Daniel Berlin
2001-04-13 13:06                       ` Andreas Schwab
2001-04-13 19:13     ` Jim Wilson
2001-04-13 19:59     ` Jim Wilson
2001-04-14  2:01       ` Jim Wilson
2001-04-14  4:08         ` Sam TH
2001-04-14  8:27           ` cvs (was: Bootstrap failure of gcc-ss-20010409 in ia64) Fergus Henderson
2001-04-14 11:28             ` Sam TH
2001-04-14 22:20             ` Jim Wilson
2001-04-14 23:48               ` Russ Allbery
2001-04-16 15:39         ` Jim Wilson [this message]
2001-04-16 17:22           ` Bootstrap failure of gcc-ss-20010409 in ia64 Mark Mitchell
2001-04-16 17:45             ` Jim Wilson
2001-04-17  8:22               ` Mark Mitchell
2001-04-17  8:57                 ` Daniel Berlin
2001-04-17 11:01                 ` Jim Wilson
2001-04-17 15:38                   ` Mark Mitchell
2001-04-17 16:16                     ` Daniel Berlin
2001-04-17 16:36                       ` Mark Mitchell
2001-04-18 14:35                       ` debugging optimized programs (Was: Re: Bootstrap failure of gcc-ss-20010409 in ia64) Joern Rennecke
2001-04-18 15:12                         ` Daniel Berlin
2001-04-18 15:49                           ` Joern Rennecke
2001-04-18 17:06                             ` Daniel Berlin
2001-04-18 17:18                               ` Daniel Berlin
2001-04-18 12:41                     ` Bootstrap failure of gcc-ss-20010409 in ia64 Jim Wilson
2001-04-18 13:49                       ` Mark Mitchell
2001-04-18 14:34                         ` Jim Wilson
2001-04-18 15:31                           ` Mark Mitchell
2001-04-17 18:12 Mike Stump
2001-04-17 19:01 ` Joe Buck
2001-04-17 20:38   ` Daniel Berlin

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=200104162239.PAA13601@wilson.cygnus.com \
    --to=wilson@cygnus.com \
    --cc=gcc@gcc.gnu.org \
    --cc=mark@codesourcery.com \
    /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).