public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/54705] New: Building gcc with ADA and LTO results in an internal error
@ 2012-09-25 14:23 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
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: mikulas at artax dot karlin.mff.cuni.cz @ 2012-09-25 14:23 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 54705
           Summary: Building gcc with ADA and LTO results in an internal
                    error
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mikulas@artax.karlin.mff.cuni.cz


When gcc is being built with ada and lto, it fails with an internal error:

ada/b_gnat1.adb:196:7: warning: type of 'locking_policy' does not match
original declaration [enabled by default]
In file included from /usr/include/unistd.h:563:0,
                 from ../../gcc-4.7.2/gcc/ada/cstreams.c:268,
                 from /usr/include/stdio.h:188,
                 from <built-in>:10,
                 from <built-in>:5,
                 from <built-in>:78,
                 from :9:
../../gcc-4.7.2/gcc/ada/init.c:96:7: note: previously declared here
lto1: internal compiler error: in output_die, at dwarf2out.c:8469
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
lto-wrapper: /usr/src/gcc-4.7.2-build-5/./prev-gcc/g++ returned 1 exit status
/usr/local/bin/ld: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[3]: *** [gnat1] Error 1
make[3]: *** Waiting for unfinished jobs....
In file included from :1725:0:
../../gcc-4.7.2/gcc/lto/lto-lang.c: In function 'lto_define_builtins':
../../gcc-4.7.2/gcc/lto/lto-lang.c:587:0: note: variable tracking size limit
exceeded with -fvar-tracking-assignments, retrying without
rm gcc.pod
make[3]: Leaving directory `/usr/src/gcc-4.7.2-build-5/gcc'
make[2]: *** [all-stage2-gcc] Error 2
make[2]: Leaving directory `/usr/src/gcc-4.7.2-build-5'
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory `/usr/src/gcc-4.7.2-build-5'
make: *** [all] Error 2
Command exited with non-zero status 2


How to reproduce:
Use Debian 6, install gcc-4.4 and gnat-4.4 from the repository.
Build gcc 4.7.2 with this script:

#!/bin/sh
set -e
CFLAGS="-O3 -march=barcelona -fomit-frame-pointer"
export CFLAGS
CXXFLAGS="$CFLAGS"
export CXXFLAGS
../gcc-4.7.2/configure                                                  \
        --prefix=/usr/local/gcc/                                        \
        --enable-lto                                                    \
        --with-system-zlib                                              \
        --enable-languages=ada,c                                        \
        --enable-multilib                                               \
        --with-multilib-list=m32,m64                                    \
        &&
make -j8 BOOT_CFLAGS="$CFLAGS -flto"


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug lto/54705] ICE during custom LTO bootstrap with Ada enabled
  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 ` ebotcazou at gcc dot gnu.org
  2012-09-26 23:12 ` mikulas at artax dot karlin.mff.cuni.cz
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2012-09-26  8:28 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2012-09-26
                 CC|                            |ebotcazou at gcc dot
                   |                            |gnu.org
            Summary|Building gcc with ADA and   |ICE during custom LTO
                   |LTO results in an internal  |bootstrap with Ada enabled
                   |error                       |
     Ever Confirmed|0                           |1

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2012-09-26 08:27:44 UTC ---
Well, fiddling with BOOT_CFLAGS is at your own risks, LTO bootstrap works if
you use the right procedure: configure --with-build-config=bootstrap-lto and
type 'make'.  I suspect that the problem comes from the -O3 option.  That being
said, LTO indeed generates patterns that easily confuse the DWARF back-end.

However, I cannot reproduce and this is expected: the reported error can only
occur if -g is used during the bootstrap and your script doesn't have it...

And ADA is the American with Disabilities Act; the programming language is
called Ada, this is the first name of Lady Ada, Countless of Lovelace.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug lto/54705] ICE during custom LTO bootstrap with Ada enabled
  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
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mikulas at artax dot karlin.mff.cuni.cz @ 2012-09-26 23:12 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from mikulas at artax dot karlin.mff.cuni.cz 2012-09-26 23:12:18 UTC ---
My script doesn't have -g, but it is somehow added by gcc build scripts. I can
see lines like this that have -g.

/usr/src/gcc-4.7.2-build-5.1/./prev-gcc/xgcc
-B/usr/src/gcc-4.7.2-build-5.1/./prev-gcc/
-B/usr/local/gcc/x86_64-unknown-linux-gnu/bin/
-B/usr/local/gcc/x86_64-unknown-linux-gnu/bin/
-B/usr/local/gcc/x86_64-unknown-linux-gnu/lib/ -isystem
/usr/local/gcc/x86_64-unknown-linux-gnu/include -isystem
/usr/local/gcc/x86_64-unknown-linux-gnu/sys-include    -c -O3 -march=barcelona
-fomit-frame-pointer -flto -gtoggle  -gnatpg -gnata -W -Wall -g -O1 -fno-inline
\
         -nostdinc -I- -I. -Iada -I../../gcc-4.7.2/gcc/ada
-I../../gcc-4.7.2/gcc/ada/gcc-interface ../../gcc-4.7.2/gcc/ada/a-except.adb -o
ada/a-except.o

For me it is reproducible, I ran it again and it crashed again with the same
internal error. I am attaching the output of the compilation so that you can
look where the -g came from.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug lto/54705] ICE during custom LTO bootstrap with Ada enabled
  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
  4 siblings, 0 replies; 6+ messages in thread
From: mikulas at artax dot karlin.mff.cuni.cz @ 2012-09-26 23:16 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from mikulas at artax dot karlin.mff.cuni.cz 2012-09-26 23:16:04 UTC ---
Created attachment 28289
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28289
a full log of failed compiletion


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug lto/54705] ICE during custom LTO bootstrap with Ada enabled
  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
                   ` (2 preceding siblings ...)
  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
  4 siblings, 0 replies; 6+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2012-09-27 21:35 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
                 CC|ebotcazou at gcc dot        |
                   |gnu.org                     |
         AssignedTo|unassigned at gcc dot       |ebotcazou at gcc dot
                   |gnu.org                     |gnu.org

--- Comment #4 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2012-09-27 21:34:53 UTC ---
Investigating.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug lto/54705] ICE during custom LTO bootstrap with Ada enabled
  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
                   ` (3 preceding siblings ...)
  2012-09-27 21:35 ` ebotcazou at gcc dot gnu.org
@ 2012-09-28  9:54 ` ebotcazou at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2012-09-28  9:54 UTC (permalink / raw)
  To: gcc-bugs


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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-09-28  9:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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).