Bug 53019 - [4.7 regression] ICE (segfault) with -flto=jobserver -fwhole-program
Summary: [4.7 regression] ICE (segfault) with -flto=jobserver -fwhole-program
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: lto (show other bugs)
Version: 4.7.0
: P2 normal
Target Milestone: 4.7.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-17 12:57 UTC by Matthias Klose
Modified: 2012-06-01 09:12 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.6.3
Known to fail: 4.7.0
Last reconfirmed: 2012-04-26 00:00:00


Attachments
test case (5.71 KB, application/x-gzip)
2012-04-17 12:57 UTC, Matthias Klose
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2012-04-17 12:57:37 UTC
Created attachment 27177 [details]
test case

works with 4.6.3, fails with 4.7 (at least on x86_64-linux-gnu)

$ make
g++-4.7 -O2 -flto=jobserver -fwhole-program -c clua.cc -o clua.o
g++-4.7 -O2 -flto=jobserver -fwhole-program -c l_global.cc -o l_global.o
g++-4.7 -O2 -flto=jobserver -fwhole-program clua.o l_global.o -o /dev/null
In file included from :22:0:
l_global.cc: In function '_ZNSt8_Rb_treeISsSt4pairIKSs18basic_text_patternIXadL_Z15compile_patternPKcbEEXadL_Z21free_compiled_patternPvEEXadL_Z13pattern_matchS5_S4_iEEEESt10_Select1stIS7_ESt4lessISsEN9__gnu_cxx13new_allocatorIS7_EEE14_M_lower_boundEPSt13_Rb_tree_nodeIS7_ESI_RS1_.isra.12.3024.constprop.51':
l_global.cc:310:169: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
Comment 1 Andrew Pinski 2012-04-24 23:03:11 UTC
This works on the trunk, we get undefined references.

Are you using gold or BFD ld?
Comment 2 Richard Biener 2012-04-26 14:20:19 UTC
Confirmed.  It is an ICE in set_is_used, the var annotation is NULL.  Called
from remove_unused_locals.

This sounds somewhat familiar ...
Comment 3 Adam Borowski 2012-05-08 20:20:48 UTC
Trunk fails for me, although not on this reduced testcase.
The message says the problem is the same:

In file included from :8272:0:
/usr/lib/gcc-snapshot/include/c++/4.8.0/bits/stl_tree.h: In function '_ZNSt8_Rb_treeISsSt4pairIKSs18basic_text_patternIXadL_Z15compile_patternPKcbEEXadL_Z21free_compiled_patternPvEEXadL_Z13pattern_matchS5_S4_iEEEESt10_Select1stIS7_ESt4lessISsESaIS7_EE14_M_lower_boundEPSt13_Rb_tree_nodeIS7_ESG_RS1_.isra.17.794313.constprop.6959':
/usr/lib/gcc-snapshot/include/c++/4.8.0/bits/stl_tree.h:1093:0: internal compiler error: Segmentation fault
     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 ^

Both gold and BFD.

Should I delta it again to get something that breaks on both trunk and 4.7?
Comment 4 Richard Biener 2012-05-30 14:38:37 UTC
Fixed on trunk, no longer reproduces on the 4.7 branch for me (rev. 188004),
reproduces with branch rev. 187228.  Can you re-check please?
Comment 5 Adam Borowski 2012-05-30 21:56:36 UTC
The changelog for Debian upload which included the fix is:

  * Update to SVN 20120509 (r187339) from the gcc-4_7-branch.
    - Fix PR libstdc++/53193, PR target/53272, PR tree-optimization/53239,
      PR tree-optimization/53195, PR target/52999, PR target/53228,
      PR tree-optimization/52633, PR tree-optimization/52870, PR target/48496,
      PR target/53199, PR target/52684, PR lto/52605, PR plugins/53126,
      PR debug/53174, PR target/53187, PR tree-optimization/53144,
      PR c++/53186, PR fortran/53255, PR fortran/53111, PR fortran/52864.
Previous one was SVN 20120502 (r187039).

I'll try trunk, although with its complex build system and me being quite busy, I sadly don't promise to finish it by tonight.
Comment 6 Adam Borowski 2012-06-01 08:04:43 UTC
Ok, works correctly on current trunk as well.

Since the testcase is messy and vulnerable to small alterations, and I guess the underlying bug fixes already include a test for it, it's probably pointless to try to introduce a variant of this one.

Thus, nothing more to do here.  Thanks guys for the fix, let's close this one.
Comment 7 Richard Biener 2012-06-01 09:12:08 UTC
Fixed.