public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ebotcazou at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug lto/54705] ICE during custom LTO bootstrap with Ada enabled
Date: Fri, 28 Sep 2012 09:54:00 -0000	[thread overview]
Message-ID: <bug-54705-4-sqY2V1LLUq@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-54705-4@http.gcc.gnu.org/bugzilla/>


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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX

--- Comment #5 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2012-09-28 09:54:15 UTC ---
#2  0x00000000005628db in output_die (die=0x7fffebb91460)
    at /home/eric/svn/gcc-4_7-branch/gcc/dwarf2out.c:8469
8469                  gcc_assert (AT_ref (a)->die_offset);
(gdb) p debug_dwarf_die(die)
DIE 360467: DW_TAG_GNU_call_site (0x7fffebb91460)
  abbrev id: 93 offset: 360467 mark: 1
  DW_AT_low_pc: label: *.LVL14079
  DW_AT_abstract_origin: die -> 0 (0x7fffeb8a6f00)

We have a cycle in the debug info:

(gdb) p a->dw_attr_val.v.val_die_ref.die
$25 = (dw_die_ref) 0x7fffeb8a6f00
(gdb) p a->dw_attr_val.v.val_die_ref.die->die_parent
$26 = (dw_die_ref) 0x7fffeb8c4820
(gdb) p a->dw_attr_val.v.val_die_ref.die->die_parent->die_parent
$27 = (dw_die_ref) 0x7fffeb8c4780
(gdb) p a->dw_attr_val.v.val_die_ref.die->die_parent->die_parent->die_parent
$28 = (dw_die_ref) 0x7fffeb8a6f00

(gdb) p *a->dw_attr_val.v.val_die_ref.die
$21 = {die_id = {die_symbol = 0x0, die_type_node = 0x0}, 
  die_attr = 0x7fffeb86dc60, die_parent = 0x7fffeb8c4820, 
  die_child = 0x7fffeb8c4d20, die_sib = 0x7fffeb8c48c0, die_definition = 0x0, 
  die_offset = 0, die_abbrev = 0, die_mark = 2, die_perennial_p = 0, 
  decl_id = 4952, die_tag = DW_TAG_subprogram}

(gdb) p *a->dw_attr_val.v.val_die_ref.die->die_parent
$22 = {die_id = {die_symbol = 0x0, die_type_node = 0x0}, 
  die_attr = 0x7fffeb8c1528, die_parent = 0x7fffeb8c4780, 
  die_child = 0x7fffeb8c4be0, die_sib = 0x7fffeb8c47d0, die_definition = 0x0, 
  die_offset = 0, die_abbrev = 0, die_mark = 2, die_perennial_p = 0, 
  decl_id = 0, die_tag = DW_TAG_lexical_block}

(gdb) p *a->dw_attr_val.v.val_die_ref.die->die_parent->die_parent
$23 = {die_id = {die_symbol = 0x0, die_type_node = 0x0}, 
  die_attr = 0x7fffeb8c6360, die_parent = 0x7fffeb8a6f00, 
  die_child = 0x7fffeb8c4820, die_sib = 0x7fffeb8c4d20, die_definition = 0x0, 
  die_offset = 0, die_abbrev = 0, die_mark = 2, die_perennial_p = 0, 
  decl_id = 0, die_tag = DW_TAG_inlined_subroutine}

(gdb) p *a->dw_attr_val.v.val_die_ref.die->die_parent->die_parent->die_parent
$24 = {die_id = {die_symbol = 0x0, die_type_node = 0x0}, 
  die_attr = 0x7fffeb86dc60, die_parent = 0x7fffeb8c4820, 
  die_child = 0x7fffeb8c4d20, die_sib = 0x7fffeb8c48c0, die_definition = 0x0, 
  die_offset = 0, die_abbrev = 0, die_mark = 2, die_perennial_p = 0, 
  decl_id = 4952, die_tag = DW_TAG_subprogram}

That's the usual mess with inlined nested subprograms, see
  http://gcc.gnu.org/ml/gcc-patches/2012-03/msg00161.html
for a discussion and LTO further screws things up.

Sorting this out properly is probably impossible, so here are 2 workarounds:

 1.  This patchlet:

Index: dwarf2out.c
===================================================================
--- dwarf2out.c (revision 191561)
+++ dwarf2out.c (working copy)
@@ -17193,7 +17193,7 @@ gen_call_site_die (tree decl, dw_die_ref
       dw_die_ref tdie = lookup_decl_die (SYMBOL_REF_DECL
(ca_loc->symbol_ref));
       if (tdie)
        add_AT_die_ref (die, DW_AT_abstract_origin, tdie);
-      else
+      else if (!in_lto_p)
        add_AT_addr (die, DW_AT_abstract_origin, ca_loc->symbol_ref);
     }
   return die;

works around 3 different crashes with -flto -g for Ada programs I know of.
For some reason, the new DW_TAG_GNU_call_site stuff has made things worse.

 2. Do a canonical LTO bootstrap, i.e. add --with-build-config=bootstrap-lto to
the configure line and remove -flto from BOOT_CFLAGS.


      parent reply	other threads:[~2012-09-28  9:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-25 14:23 [Bug lto/54705] New: Building gcc with ADA and LTO results in an internal error mikulas at artax dot karlin.mff.cuni.cz
2012-09-26  8:28 ` [Bug lto/54705] ICE during custom LTO bootstrap with Ada enabled ebotcazou at gcc dot gnu.org
2012-09-26 23:12 ` mikulas at artax dot karlin.mff.cuni.cz
2012-09-26 23:16 ` mikulas at artax dot karlin.mff.cuni.cz
2012-09-27 21:35 ` ebotcazou at gcc dot gnu.org
2012-09-28  9:54 ` ebotcazou at gcc dot gnu.org [this message]

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-54705-4-sqY2V1LLUq@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).