public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/53470] New: [4.8 LTO] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264
@ 2012-05-24  9:43 vincenzo.innocente at cern dot ch
  2012-05-24  9:55 ` [Bug lto/53470] " rguenth at gcc dot gnu.org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2012-05-24  9:43 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53470
           Summary: [4.8 LTO] ICE when linking with -g in
                    splice_child_die, at dwarf2out.c:4264
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: vincenzo.innocente@cern.ch


Created attachment 27487
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27487
real-life code preprocessed file

I encountered this while compiling with "-g" just few files in my project.
make propagated the "-g" to the linking step that included also object files
previously compiled without "-g".

The example below reproduces the error with just one file


c++ -flto -O2 -fPIC iceDebug.ii -shared -c -std=gnu++11 -msse3
[vocms123] /build/vin/newb/CMSSW_6_0_X_2012-05-14-1400 $ c++ -g -flto -O2 -fPIC
iceDebug.o -shared -o bha.so -std=gnu++11 -msse3
In file included from
/build/ge/new-binutils/a/slc5_amd64_gcc470/external/boost/1.49.0-cms3/include/boost/checked_delete.hpp:51:0,
                 from :322:
/build/ge/new-binutils/a/slc5_amd64_gcc470/external/boost/1.49.0-cms3/include/boost/smart_ptr/detail/sp_counted_impl.hpp:
In member function 'get_deleter':
/build/ge/new-binutils/a/slc5_amd64_gcc470/external/boost/1.49.0-cms3/include/boost/smart_ptr/detail/sp_counted_impl.hpp:84:5:
internal compiler error: in splice_child_die, at dwarf2out.c:4264
     }
     ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
lto-wrapper: c++ returned 1 exit status
/afs/cern.ch/user/i/innocent/w3/gcc47slc5/bin/ld: fatal error: lto-wrapper
failed
collect2: error: ld returned 1 exit status

happens in many other contexts, always at dwarf2out.c:4264

cc version 4.8.0 20120524 (experimental) [trunk revision 187822] (GCC) 
GNU gold (GNU Binutils 2.22.52.20120515) 1.11


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

* [Bug lto/53470] [4.8 LTO] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264
  2012-05-24  9:43 [Bug lto/53470] New: [4.8 LTO] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264 vincenzo.innocente at cern dot ch
@ 2012-05-24  9:55 ` rguenth at gcc dot gnu.org
  2012-05-24 17:24 ` hjl.tools at gmail dot com
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-05-24  9:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-05-24 09:47:24 UTC ---
That can unfortunately happen (I thought we ironed out most of these bugs,
but obviously testing coverage for this case isn't as good).


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

* [Bug lto/53470] [4.8 LTO] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264
  2012-05-24  9:43 [Bug lto/53470] New: [4.8 LTO] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264 vincenzo.innocente at cern dot ch
  2012-05-24  9:55 ` [Bug lto/53470] " rguenth at gcc dot gnu.org
@ 2012-05-24 17:24 ` hjl.tools at gmail dot com
  2012-05-25  7:52 ` vincenzo.innocente at cern dot ch
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: hjl.tools at gmail dot com @ 2012-05-24 17:24 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2012-05-24
                 CC|                            |hjl.tools at gmail dot com
     Ever Confirmed|0                           |1

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> 2012-05-24 17:15:57 UTC ---
Works for me on Linux/x86-64 with revision 187825 and BFD linker on
trunk.  Can you try BFD linker?


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

* [Bug lto/53470] [4.8 LTO] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264
  2012-05-24  9:43 [Bug lto/53470] New: [4.8 LTO] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264 vincenzo.innocente at cern dot ch
  2012-05-24  9:55 ` [Bug lto/53470] " rguenth at gcc dot gnu.org
  2012-05-24 17:24 ` hjl.tools at gmail dot com
@ 2012-05-25  7:52 ` vincenzo.innocente at cern dot ch
  2012-05-25  8:37 ` markus at trippelsdorf dot de
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2012-05-25  7:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from vincenzo Innocente <vincenzo.innocente at cern dot ch> 2012-05-25 06:59:33 UTC ---
same problem with BDF

cp /build/vin/binutils/build/gold/ld-new
/afs/cern.ch/user/i/innocent/w3/gcc47slc5/bin/ld
[vocms123] /build/vin/newb/CMSSW_6_0_X_2012-05-14-1400 $ c++ -g -flto -O2 -fPIC
iceDebug.o -shared -o bha.so -std=gnu++11 -msse3 -Wl,-v
collect2 version 4.8.0 20120524 (experimental) [trunk revision 187822]
/afs/cern.ch/user/i/innocent/w3/gcc47slc5/bin/ld -plugin
/afs/cern.ch/user/i/innocent/w3/gcc47slc5/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/liblto_plugin.so
-plugin-opt=/afs/cern.ch/user/i/innocent/w3/gcc47slc5/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper
-plugin-opt=-fresolution=/tmp/innocent/cc4re4Jl.res
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf_x86_64 -shared -o
bha.so /usr/lib/../lib64/crti.o
/afs/cern.ch/user/i/innocent/w3/gcc47slc5/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/crtbeginS.o
-L/afs/cern.ch/user/i/innocent/w3/gcc47slc5/lib/gcc/x86_64-unknown-linux-gnu/4.8.0
-L/afs/cern.ch/user/i/innocent/w3/gcc47slc5/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../lib64
-L/lib/../lib64 -L/usr/lib/../lib64
-L/afs/cern.ch/user/i/innocent/w3/gcc47slc5/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../..
iceDebug.o -v -lstdc++ -lm -lgcc_s -lc -lgcc_s
/afs/cern.ch/user/i/innocent/w3/gcc47slc5/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/crtendS.o
/usr/lib/../lib64/crtn.o
GNU gold (GNU Binutils 2.22.52.20120515) 1.11
In file included from
/build/ge/new-binutils/a/slc5_amd64_gcc470/external/boost/1.49.0-cms3/include/boost/checked_delete.hpp:51:0,
                 from :322:
/build/ge/new-binutils/a/slc5_amd64_gcc470/external/boost/1.49.0-cms3/include/boost/smart_ptr/detail/sp_counted_impl.hpp:
In member function 'get_deleter':
/build/ge/new-binutils/a/slc5_amd64_gcc470/external/boost/1.49.0-cms3/include/boost/smart_ptr/detail/sp_counted_impl.hpp:84:5:
internal compiler error: in splice_child_die, at dwarf2out.c:4264
     }
     ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
lto-wrapper: c++ returned 1 exit status
/afs/cern.ch/user/i/innocent/w3/gcc47slc5/bin/ld: fatal error: lto-wrapper
failed
collect2: error: ld returned 1 exit status

[vocms123] /build/vin/newb/CMSSW_6_0_X_2012-05-14-1400 $ cp
/build/vin/binutils/build/ld/ld-new
/afs/cern.ch/user/i/innocent/w3/gcc47slc5/bin/ld
[vocms123] /build/vin/newb/CMSSW_6_0_X_2012-05-14-1400 $ c++ -g -flto -O2 -fPIC
iceDebug.o -shared -o bha.so -std=gnu++11 -msse3 -Wl,-v
collect2 version 4.8.0 20120524 (experimental) [trunk revision 187822]
/afs/cern.ch/user/i/innocent/w3/gcc47slc5/bin/ld -plugin
/afs/cern.ch/user/i/innocent/w3/gcc47slc5/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/liblto_plugin.so
-plugin-opt=/afs/cern.ch/user/i/innocent/w3/gcc47slc5/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper
-plugin-opt=-fresolution=/tmp/innocent/cc8URSUA.res
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf_x86_64 -shared -o
bha.so /usr/lib/../lib64/crti.o
/afs/cern.ch/user/i/innocent/w3/gcc47slc5/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/crtbeginS.o
-L/afs/cern.ch/user/i/innocent/w3/gcc47slc5/lib/gcc/x86_64-unknown-linux-gnu/4.8.0
-L/afs/cern.ch/user/i/innocent/w3/gcc47slc5/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../lib64
-L/lib/../lib64 -L/usr/lib/../lib64
-L/afs/cern.ch/user/i/innocent/w3/gcc47slc5/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../..
iceDebug.o -v -lstdc++ -lm -lgcc_s -lc -lgcc_s
/afs/cern.ch/user/i/innocent/w3/gcc47slc5/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/crtendS.o
/usr/lib/../lib64/crtn.o
GNU ld (GNU Binutils) 2.22.52.20120515
In file included from
/build/ge/new-binutils/a/slc5_amd64_gcc470/external/boost/1.49.0-cms3/include/boost/checked_delete.hpp:51:0,
                 from :322:
/build/ge/new-binutils/a/slc5_amd64_gcc470/external/boost/1.49.0-cms3/include/boost/smart_ptr/detail/sp_counted_impl.hpp:
In member function 'get_deleter':
/build/ge/new-binutils/a/slc5_amd64_gcc470/external/boost/1.49.0-cms3/include/boost/smart_ptr/detail/sp_counted_impl.hpp:84:5:
internal compiler error: in splice_child_die, at dwarf2out.c:4264
     }
     ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
lto-wrapper: c++ returned 1 exit status
/afs/cern.ch/user/i/innocent/w3/gcc47slc5/bin/ld: lto-wrapper failed
collect2: error: ld returned 1 exit status


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

* [Bug lto/53470] [4.8 LTO] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264
  2012-05-24  9:43 [Bug lto/53470] New: [4.8 LTO] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264 vincenzo.innocente at cern dot ch
                   ` (2 preceding siblings ...)
  2012-05-25  7:52 ` vincenzo.innocente at cern dot ch
@ 2012-05-25  8:37 ` markus at trippelsdorf dot de
  2012-05-25 12:37 ` [Bug debug/53470] [4.8 Regression] " hjl.tools at gmail dot com
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: markus at trippelsdorf dot de @ 2012-05-25  8:37 UTC (permalink / raw)
  To: gcc-bugs

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

Markus Trippelsdorf <markus at trippelsdorf dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |markus at trippelsdorf dot
                   |                            |de

--- Comment #4 from Markus Trippelsdorf <markus at trippelsdorf dot de> 2012-05-25 08:33:01 UTC ---
Here is a small testcase:

markus@x4 tmp % cat test.ii
class sp_counted_base;
class shared_count {
  sp_counted_base *pi_;
public:
  template<class Y> shared_count(Y) : pi_() {}
  ~shared_count() {}
};
template<class T> struct shared_ptr {
  T element_type;
  template<class Y> shared_ptr(Y) : pn(0) {}
  shared_count pn;
};
template<class> class ECGetterBase;
template<class T> struct ExtensionCord {
  struct Holder {
    ECGetterBase<T> *getter_;
  };
  ExtensionCord() : holder_(new Holder) {}

  shared_ptr<Holder> holder_;
};
ExtensionCord<int> a;

markus@x4 tmp % c++ -flto -g test.ii
lto1: internal compiler error: in splice_child_die, at dwarf2out.c:4264
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
lto-wrapper: /usr/x86_64-pc-linux-gnu/gcc-bin/4.8.0/c++ returned 1 exit status
/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.0/../../../../x86_64-pc-linux-gnu/bin/ld:
fatal error: lto-wrapper failed
collect2: error: ld returned 1 exit status


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

* [Bug debug/53470] [4.8 Regression] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264
  2012-05-24  9:43 [Bug lto/53470] New: [4.8 LTO] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264 vincenzo.innocente at cern dot ch
                   ` (3 preceding siblings ...)
  2012-05-25  8:37 ` markus at trippelsdorf dot de
@ 2012-05-25 12:37 ` hjl.tools at gmail dot com
  2012-05-29 10:46 ` rguenth at gcc dot gnu.org
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: hjl.tools at gmail dot com @ 2012-05-25 12:37 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
                 CC|                            |jason at redhat dot com
          Component|lto                         |debug
   Target Milestone|---                         |4.8.0
            Summary|[4.8 LTO] ICE when linking  |[4.8 Regression] ICE when
                   |with -g in                  |linking with -g in
                   |splice_child_die, at        |splice_child_die, at
                   |dwarf2out.c:4264            |dwarf2out.c:4264

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> 2012-05-25 12:31:12 UTC ---
It is caused by revision 187106:

http://gcc.gnu.org/ml/gcc-cvs/2012-05/msg00102.html


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

* [Bug debug/53470] [4.8 Regression] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264
  2012-05-24  9:43 [Bug lto/53470] New: [4.8 LTO] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264 vincenzo.innocente at cern dot ch
                   ` (4 preceding siblings ...)
  2012-05-25 12:37 ` [Bug debug/53470] [4.8 Regression] " hjl.tools at gmail dot com
@ 2012-05-29 10:46 ` rguenth at gcc dot gnu.org
  2012-06-05 18:07 ` jason at gcc dot gnu.org
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-05-29 10:46 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |lto
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-05-29 10:33:56 UTC ---
I'll have a look.


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

* [Bug debug/53470] [4.8 Regression] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264
  2012-05-24  9:43 [Bug lto/53470] New: [4.8 LTO] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264 vincenzo.innocente at cern dot ch
                   ` (5 preceding siblings ...)
  2012-05-29 10:46 ` rguenth at gcc dot gnu.org
@ 2012-06-05 18:07 ` jason at gcc dot gnu.org
  2012-06-06 11:56 ` rguenther at suse dot de
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: jason at gcc dot gnu.org @ 2012-06-05 18:07 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2012-06-05 18:07:14 UTC ---
OK, here's the problem:

free_lang_data_in_type clears TYPE_CONTEXT of Holder.
gen_tagged_type_die tries to emit an enclosing class first, but since
TYPE_CONTEXT is null, it thinks Holder isn't a nested class.
gen_struct_or_union_type_die calls scope_die_for, which forces out
ExtensionCord, which also generates a DIE for Holder.
gen_struct_or_union_type_die contiues to generate what is now a duplicate DIE
for Holder.

What is the rationale for clearing TYPE_CONTEXT of Holder?  It seems quite
deliberate, but there's no comment explaining why it would be a good idea.


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

* [Bug debug/53470] [4.8 Regression] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264
  2012-05-24  9:43 [Bug lto/53470] New: [4.8 LTO] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264 vincenzo.innocente at cern dot ch
                   ` (6 preceding siblings ...)
  2012-06-05 18:07 ` jason at gcc dot gnu.org
@ 2012-06-06 11:56 ` rguenther at suse dot de
  2012-06-06 15:27 ` jason at gcc dot gnu.org
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rguenther at suse dot de @ 2012-06-06 11:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from rguenther at suse dot de <rguenther at suse dot de> 2012-06-06 11:55:32 UTC ---
On Tue, 5 Jun 2012, jason at gcc dot gnu.org wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53470
> 
> Jason Merrill <jason at gcc dot gnu.org> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |jason at gcc dot gnu.org
> 
> --- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2012-06-05 18:07:14 UTC ---
> OK, here's the problem:
> 
> free_lang_data_in_type clears TYPE_CONTEXT of Holder.
> gen_tagged_type_die tries to emit an enclosing class first, but since
> TYPE_CONTEXT is null, it thinks Holder isn't a nested class.
> gen_struct_or_union_type_die calls scope_die_for, which forces out
> ExtensionCord, which also generates a DIE for Holder.
> gen_struct_or_union_type_die contiues to generate what is now a duplicate DIE
> for Holder.
> 
> What is the rationale for clearing TYPE_CONTEXT of Holder?  It seems quite
> deliberate, but there's no comment explaining why it would be a good idea.

All of the clearing is done to push down memory usage and/or cause
types to be referenced that are otherwise unused.  A way to retain the
latter would be to not recurse into TYPE_CONTEXT during find_decls_types_r
and in free_lang_data_in_type only reset TYPE_CONTEXT when
that is not in fld.pset (thus we didn't visit it, aka, it is unused).

Not sure if this will reliably fix this kind of ICEs.

Note that the fundamental issue with running free-lang-data with -g0
and lto1 with -g is that free-lang-data with -g0 assumes we won't
generate debug information.  I think the case in question is the
only remaining case we do different things -g0 vs. -g in
free-lang-data - and we should definitely remove that inconsistency.

Thus, I suppose even the simple

Index: tree.c
===================================================================
--- tree.c      (revision 188260)
+++ tree.c      (working copy)
@@ -4575,10 +4575,9 @@ free_lang_data_in_type (tree type)
   free_lang_data_in_one_sizepos (&TYPE_SIZE (type));
   free_lang_data_in_one_sizepos (&TYPE_SIZE_UNIT (type));

-  if (debug_info_level < DINFO_LEVEL_TERSE
-      || (TYPE_CONTEXT (type)
-         && TREE_CODE (TYPE_CONTEXT (type)) != FUNCTION_DECL
-         && TREE_CODE (TYPE_CONTEXT (type)) != NAMESPACE_DECL))
+  if (TYPE_CONTEXT (type)
+      && TREE_CODE (TYPE_CONTEXT (type)) != FUNCTION_DECL
+      && TREE_CODE (TYPE_CONTEXT (type)) != NAMESPACE_DECL)
     TYPE_CONTEXT (type) = NULL_TREE;
 }

should be ok at the expense of extra memory/disk space usage at -g0
(note we walk TYPE_CONTEXT for all types in find_decls_types_r, so
even the restriction above looks odd - either we should restrict
recursion as well or never clear TYPE_CONTEXT).

Richard.


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

* [Bug debug/53470] [4.8 Regression] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264
  2012-05-24  9:43 [Bug lto/53470] New: [4.8 LTO] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264 vincenzo.innocente at cern dot ch
                   ` (7 preceding siblings ...)
  2012-06-06 11:56 ` rguenther at suse dot de
@ 2012-06-06 15:27 ` jason at gcc dot gnu.org
  2012-06-06 16:11 ` jason at gcc dot gnu.org
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: jason at gcc dot gnu.org @ 2012-06-06 15:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> 2012-06-06 15:27:02 UTC ---
(In reply to comment #8)
> All of the clearing is done to push down memory usage and/or cause
> types to be referenced that are otherwise unused.  A way to retain the
> latter would be to not recurse into TYPE_CONTEXT during find_decls_types_r
> and in free_lang_data_in_type only reset TYPE_CONTEXT when
> that is not in fld.pset (thus we didn't visit it, aka, it is unused).

If a type is nested inside another type, using the inner type necessarily uses
the outer type; we need to at least declare the outer type so we have some
place to put the inner type.  So I don't think there's any optimization
opportunity here.

> Note that the fundamental issue with running free-lang-data with -g0
> and lto1 with -g is that free-lang-data with -g0 assumes we won't
> generate debug information.

Yes, but that isn't the problem with this PR; in this case cc1plus and lto1 are
both run with -g.  free_lang_data_in_type is clearing TYPE_CONTEXT even though
we want full debug information, and this lying to the debugging back end
results in the ICE.


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

* [Bug debug/53470] [4.8 Regression] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264
  2012-05-24  9:43 [Bug lto/53470] New: [4.8 LTO] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264 vincenzo.innocente at cern dot ch
                   ` (8 preceding siblings ...)
  2012-06-06 15:27 ` jason at gcc dot gnu.org
@ 2012-06-06 16:11 ` jason at gcc dot gnu.org
  2012-06-11 12:38 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: jason at gcc dot gnu.org @ 2012-06-06 16:11 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|jason at redhat dot com     |

--- Comment #10 from Jason Merrill <jason at gcc dot gnu.org> 2012-06-06 16:09:59 UTC ---
I wish bugzilla were clever enough not to add me to CC if my other email
address is already there...


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

* [Bug debug/53470] [4.8 Regression] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264
  2012-05-24  9:43 [Bug lto/53470] New: [4.8 LTO] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264 vincenzo.innocente at cern dot ch
                   ` (9 preceding siblings ...)
  2012-06-06 16:11 ` jason at gcc dot gnu.org
@ 2012-06-11 12:38 ` rguenth at gcc dot gnu.org
  2012-06-11 12:55 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-06-11 12:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-11 12:38:06 UTC ---
Removing the whole

  if (debug_info_level < DINFO_LEVEL_TERSE
      || (TYPE_CONTEXT (type)
          && TREE_CODE (TYPE_CONTEXT (type)) != FUNCTION_DECL
          && TREE_CODE (TYPE_CONTEXT (type)) != NAMESPACE_DECL))
    TYPE_CONTEXT (type) = NULL_TREE;

block causes us to ICE for gcc.c-torture/execute/20111208-1.c and
gcc.c-torture/execute/pr42833.c

Even though I think that would be the correct thing to do.

Reduced testcase for that ICE:

int main ()
{
  {
    union { } v;  
  }
}

works with

int main ()
{
  union { } v;  
}


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

* [Bug debug/53470] [4.8 Regression] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264
  2012-05-24  9:43 [Bug lto/53470] New: [4.8 LTO] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264 vincenzo.innocente at cern dot ch
                   ` (10 preceding siblings ...)
  2012-06-11 12:38 ` rguenth at gcc dot gnu.org
@ 2012-06-11 12:55 ` rguenth at gcc dot gnu.org
  2012-06-11 13:37 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-06-11 12:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-11 12:54:50 UTC ---
It seems we never come along with a DECL_CONTEXT that is a BLOCK (nor does
the C++ frontend do that ...).  Replacing the TYPE_CONTEXT clearing with

  if (TYPE_CONTEXT (type)
      && TREE_CODE (TYPE_CONTEXT (type)) == BLOCK)
    {
      tree ctx = TYPE_CONTEXT (type);
      do
        {
          ctx = BLOCK_SUPERCONTEXT (ctx);
        }
      while (ctx && TREE_CODE (ctx) == BLOCK);
      TYPE_CONTEXT (type) = ctx;
    }

thus, replace a BLOCK context with the first non-BLOCK context, works.


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

* [Bug debug/53470] [4.8 Regression] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264
  2012-05-24  9:43 [Bug lto/53470] New: [4.8 LTO] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264 vincenzo.innocente at cern dot ch
                   ` (11 preceding siblings ...)
  2012-06-11 12:55 ` rguenth at gcc dot gnu.org
@ 2012-06-11 13:37 ` jason at gcc dot gnu.org
  2012-06-11 14:14 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: jason at gcc dot gnu.org @ 2012-06-11 13:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Jason Merrill <jason at gcc dot gnu.org> 2012-06-11 13:37:27 UTC ---
(In reply to comment #12)
> thus, replace a BLOCK context with the first non-BLOCK context, works.

That sounds good.


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

* [Bug debug/53470] [4.8 Regression] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264
  2012-05-24  9:43 [Bug lto/53470] New: [4.8 LTO] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264 vincenzo.innocente at cern dot ch
                   ` (12 preceding siblings ...)
  2012-06-11 13:37 ` jason at gcc dot gnu.org
@ 2012-06-11 14:14 ` rguenth at gcc dot gnu.org
  2012-06-11 14:16 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-06-11 14:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-11 14:14:15 UTC ---
Author: rguenth
Date: Mon Jun 11 14:14:09 2012
New Revision: 188387

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188387
Log:
2012-06-11  Richard Guenther  <rguenther@suse.de>

    PR middle-end/53470
    * tree.c (free_lang_data_in_type): Do not clear TYPE_CONTEXT but
    replace it with the first non-BLOCK context.

    * g++.dg/lto/pr53470_0.C: New testcase.
    * gcc.dg/lto/pr53470_0.c: Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/lto/pr53470_0.C
    trunk/gcc/testsuite/gcc.dg/lto/pr53470_0.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree.c


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

* [Bug debug/53470] [4.8 Regression] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264
  2012-05-24  9:43 [Bug lto/53470] New: [4.8 LTO] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264 vincenzo.innocente at cern dot ch
                   ` (13 preceding siblings ...)
  2012-06-11 14:14 ` rguenth at gcc dot gnu.org
@ 2012-06-11 14:16 ` rguenth at gcc dot gnu.org
  2012-06-12  5:17 ` vincenzo.innocente at cern dot ch
  2013-02-19 20:38 ` LpSolit at netscape dot net
  16 siblings, 0 replies; 18+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-06-11 14:16 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #15 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-11 14:16:22 UTC ---
Fixed.


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

* [Bug debug/53470] [4.8 Regression] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264
  2012-05-24  9:43 [Bug lto/53470] New: [4.8 LTO] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264 vincenzo.innocente at cern dot ch
                   ` (14 preceding siblings ...)
  2012-06-11 14:16 ` rguenth at gcc dot gnu.org
@ 2012-06-12  5:17 ` vincenzo.innocente at cern dot ch
  2013-02-19 20:38 ` LpSolit at netscape dot net
  16 siblings, 0 replies; 18+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2012-06-12  5:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from vincenzo Innocente <vincenzo.innocente at cern dot ch> 2012-06-12 05:16:28 UTC ---
Confirmed that the fix solves the problem as I originally observed.


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

* [Bug debug/53470] [4.8 Regression] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264
  2012-05-24  9:43 [Bug lto/53470] New: [4.8 LTO] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264 vincenzo.innocente at cern dot ch
                   ` (15 preceding siblings ...)
  2012-06-12  5:17 ` vincenzo.innocente at cern dot ch
@ 2013-02-19 20:38 ` LpSolit at netscape dot net
  16 siblings, 0 replies; 18+ messages in thread
From: LpSolit at netscape dot net @ 2013-02-19 20:38 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #17 from Jason Merrill <jason at gcc dot gnu.org> 2012-06-20 07:22:13 UTC ---
Author: jason
Date: Wed Jun 20 07:22:07 2012
New Revision: 188811

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188811
Log:
2012-06-11  Richard Guenther  <rguenther@suse.de>

    PR middle-end/53470
    * tree.c (free_lang_data_in_type): Do not clear TYPE_CONTEXT but
    replace it with the first non-BLOCK context.

    * g++.dg/lto/pr53470_0.C: New testcase.
    * gcc.dg/lto/pr53470_0.c: Likewise.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/lto/pr53470_0.C
    branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/lto/pr53470_0.c
Modified:
    branches/gcc-4_7-branch/gcc/ChangeLog
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_7-branch/gcc/tree.c


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

end of thread, other threads:[~2013-02-19 20:37 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-24  9:43 [Bug lto/53470] New: [4.8 LTO] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264 vincenzo.innocente at cern dot ch
2012-05-24  9:55 ` [Bug lto/53470] " rguenth at gcc dot gnu.org
2012-05-24 17:24 ` hjl.tools at gmail dot com
2012-05-25  7:52 ` vincenzo.innocente at cern dot ch
2012-05-25  8:37 ` markus at trippelsdorf dot de
2012-05-25 12:37 ` [Bug debug/53470] [4.8 Regression] " hjl.tools at gmail dot com
2012-05-29 10:46 ` rguenth at gcc dot gnu.org
2012-06-05 18:07 ` jason at gcc dot gnu.org
2012-06-06 11:56 ` rguenther at suse dot de
2012-06-06 15:27 ` jason at gcc dot gnu.org
2012-06-06 16:11 ` jason at gcc dot gnu.org
2012-06-11 12:38 ` rguenth at gcc dot gnu.org
2012-06-11 12:55 ` rguenth at gcc dot gnu.org
2012-06-11 13:37 ` jason at gcc dot gnu.org
2012-06-11 14:14 ` rguenth at gcc dot gnu.org
2012-06-11 14:16 ` rguenth at gcc dot gnu.org
2012-06-12  5:17 ` vincenzo.innocente at cern dot ch
2013-02-19 20:38 ` LpSolit at netscape dot net

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).