Bug 78871

Summary: Anonymous namespace and -flto -gsplit-dwarf: ICE in lhd_decl_printable_name, at langhooks.c:215
Product: gcc Reporter: Markus Trippelsdorf <trippels>
Component: debugAssignee: Not yet assigned to anyone <unassigned>
Status: NEW ---    
Severity: normal CC: mark
Priority: P3 Keywords: ice-on-valid-code
Version: 7.0   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2016-12-20 00:00:00

Description Markus Trippelsdorf 2016-12-20 16:10:49 UTC
All supported gcc versions are affected:


markus@x4 ~ % cat Util.ii
namespace {
void foo() {}
}

markus@x4 ~ % g++ -flto -gsplit-dwarf Util.ii
Util.ii: In function ‘foo’:
Util.ii:2:13: internal compiler error: in lhd_decl_printable_name, at langhooks.c:215
 void foo() {}
             ^
0x8eec74 lhd_decl_printable_name(tree_node*, int)
        /home/markus/gcc/gcc/langhooks.c:215
0x6ffa74 gen_namespace_die
        /home/markus/gcc/gcc/dwarf2out.c:25009
0x6ffa74 gen_decl_die
        /home/markus/gcc/gcc/dwarf2out.c:25215
0x70078e dwarf2out_decl
        /home/markus/gcc/gcc/dwarf2out.c:25628
0x706c2f force_decl_die
        /home/markus/gcc/gcc/dwarf2out.c:24847
0x706de5 declare_in_namespace
        /home/markus/gcc/gcc/dwarf2out.c:24947
0x700127 declare_in_namespace
        /home/markus/gcc/gcc/dwarf2out.c:24918
0x700127 gen_decl_die
        /home/markus/gcc/gcc/dwarf2out.c:25116
0x70078e dwarf2out_decl
        /home/markus/gcc/gcc/dwarf2out.c:25628
0x700cde dwarf2out_function_decl
        /home/markus/gcc/gcc/dwarf2out.c:25643
0x7762ef rest_of_handle_final
        /home/markus/gcc/gcc/final.c:4506
0x7762ef execute
        /home/markus/gcc/gcc/final.c:4548
Please submit a full bug report,
Comment 1 Martin Liška 2016-12-20 16:46:02 UTC
Confirmed.
Comment 2 Christian Gagneraud 2019-06-18 10:49:26 UTC
Confimed, that's exactly what i was trying to achieve: -flto and -gsplit-dwarf at the same time.

gcc 7.4.0-1ubuntu1~18.04.1
Comment 3 Christian Gagneraud 2019-06-18 10:50:44 UTC
And if I switch to gcc-8, I get: 
cc1plus: note: ‘-gsplit-dwarf’ is not supported with LTO, disabling

:(
Comment 4 Mark Wielaard 2020-07-17 13:28:41 UTC
I think this is (now) a duplicate of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88389