https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61436
Bug ID: 61436 Summary: [4.10 Regression]: g++.dg/tls/diag-1.C ICE (emutls) Product: gcc Version: 4.10.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: regression Assignee: unassigned at gcc dot gnu.org Reporter: hp at gcc dot gnu.org CC: hubicka at gcc dot gnu.org Host: x86_64-unknown-linux-gnu Target: mmix-knuth-mmixware This test previously passed, now it fails. A patch in the revision range (last_known_working:first_known_failing) r210000:r211121 exposed or caused these regressions. Since then (up to and including at least r211290) it fails as follows: Running /home/hp/gcctop/tmp/mbgnu0/gcc/gcc/testsuite/g++.dg/tls/tls.exp ... FAIL: g++.dg/tls/diag-1.C -std=c++98 (internal compiler error) FAIL: g++.dg/tls/diag-1.C -std=c++98 (test for excess errors) FAIL: g++.dg/tls/diag-1.C -std=c++11 (internal compiler error) FAIL: g++.dg/tls/diag-1.C -std=c++11 (test for excess errors) FAIL: g++.dg/tls/diag-1.C -std=c++1y (internal compiler error) FAIL: g++.dg/tls/diag-1.C -std=c++1y (test for excess errors) I'm guessing all emutls targets are affected. The messages in g++.log are similar: spawn -ignore SIGHUP /home/hp/gcctop/tmp/mbase0/gccobj/gcc/testsuite/g++/../../xg++ -B/home/hp/gcctop/tmp/mbase0/gccobj/gcc/testsuite/g++/../../ /home/hp/gcctop/tmp/mbase0/gcc/gcc/testsuite/g++.dg/tls/diag-1.C -fno-diagnostics-show-caret -fdiagnostics-color=never -nostdinc++ -I/home/hp/gcctop/tmp/mbase0/gccobj/mmix/libstdc++-v3/include/mmix -I/home/hp/gcctop/tmp/mbase0/gccobj/mmix/libstdc++-v3/include -I/home/hp/gcctop/tmp/mbase0/gcc/libstdc++-v3/libsupc++ -I/home/hp/gcctop/tmp/mbase0/gcc/libstdc++-v3/include/backward -I/home/hp/gcctop/tmp/mbase0/gcc/libstdc++-v3/testsuite/util -fmessage-length=0 -std=c++98 -pedantic-errors -Wno-long-long -S -isystem /home/hp/gcctop/tmp/mbase0/gccobj/mmix/./newlib/targ-include -isystem /home/hp/gcctop/tmp/mbase0/gcc/newlib/libc/include -o diag-1.s /home/hp/gcctop/tmp/mbase0/gcc/gcc/testsuite/g++.dg/tls/diag-1.C:31:1: internal compiler error: in symtab_get_node, at cgraph.h:1035 0xd610c3 symtab_get_node /home/hp/gcctop/tmp/mbase0/gcc/gcc/cgraph.h:1032 0xd610c3 varpool_get_node /home/hp/gcctop/tmp/mbase0/gcc/gcc/cgraph.h:1074 0xd610c3 varpool_node_for_decl(tree_node*) /home/hp/gcctop/tmp/mbase0/gcc/gcc/varpool.c:147 0xd54cb4 make_decl_one_only(tree_node*, tree_node*) /home/hp/gcctop/tmp/mbase0/gcc/gcc/varasm.c:5932 0xb2a14e get_emutls_init_templ_addr /home/hp/gcctop/tmp/mbase0/gcc/gcc/tree-emutls.c:254 0xb2a14e get_emutls_init_templ_addr /home/hp/gcctop/tmp/mbase0/gcc/gcc/tree-emutls.c:222 0xb2aade new_emutls_decl /home/hp/gcctop/tmp/mbase0/gcc/gcc/tree-emutls.c:339 0xb2aade create_emultls_var /home/hp/gcctop/tmp/mbase0/gcc/gcc/tree-emutls.c:717 0xd625ef varpool_for_node_and_aliases(varpool_node*, bool (*)(varpool_node*, void*), void*, bool) /home/hp/gcctop/tmp/mbase0/gcc/gcc/varpool.c:682 0xb2ba87 ipa_lower_emutls /home/hp/gcctop/tmp/mbase0/gcc/gcc/tree-emutls.c:788 0xb2ba87 execute /home/hp/gcctop/tmp/mbase0/gcc/gcc/tree-emutls.c:849 Please submit a full bug report, with preprocessed source if appropriate. Looking at the code, it seems the assert in symtab_get_node at cgraph.h:1035 trigs. This code was changed in r210901, though the assert was only copied. Still, many changes around that time by the same author, so there's a good chance the attribution is correct. :) A gdb session shows, at the gcc_assert: (gdb) p decl $15 = (const_tree) 0x7ffff7ea68e8 (gdb) pt <var_decl 0x7ffff7ea68e8 __emutls_t__ZN1BIiE1tE type <integer_type 0x7ffff7dbd690 int sizes-gimplified public type_6 SI size <integer_cst 0x7ffff7dbce28 constant 32> unit size <integer_cst 0x7ffff7dbce40 constant 4> align 32 symtab 0 alias set -1 canonical type 0x7ffff7dbd690 precision 32 min <integer_cst 0x7ffff7dbcde0 -2147483648> max <integer_cst 0x7ffff7dbcdf8 2147483647> pointer_to_this <pointer_type 0x7ffff7dd1738>> readonly used public ignored weak SI file /home/hp/gcctop/tmp/mbase0/gcc/gcc/testsuite/g++.dg/tls/diag-1.C line 25 col 12 size <integer_cst 0x7ffff7dbce28 32> unit size <integer_cst 0x7ffff7dbce40 4> align 32 context <record_type 0x7ffff7ea2540 B>> (gdb) bt #0 fancy_abort (file=0xfa7550 "/home/hp/gcctop/tmp/mbase0/gcc/gcc/cgraph.h", line=1035, function=0xfa77e0 "symtab_get_node") at /home/hp/gcctop/tmp/mbase0/gcc/gcc/diagnostic.c:1190 #1 0x0000000000d64ed4 in symtab_get_node (decl=0x7ffff7ea68e8) at /home/hp/gcctop/tmp/mbase0/gcc/gcc/cgraph.h:1032 #2 0x0000000000d64f8b in varpool_get_node (decl=0x7ffff7ea68e8) at /home/hp/gcctop/tmp/mbase0/gcc/gcc/cgraph.h:1074 #3 0x0000000000d655fc in varpool_node_for_decl (decl= <var_decl 0x7ffff7ea68e8 __emutls_t__ZN1BIiE1tE>) at /home/hp/gcctop/tmp/mbase0/gcc/gcc/varpool.c:147 #4 0x0000000000d58c85 in make_decl_one_only (decl=0x7ffff7ea68e8, comdat_group=0x7ffff7e9ca50) at /home/hp/gcctop/tmp/mbase0/gcc/gcc/varasm.c:5932 #5 0x0000000000b2e11f in get_emutls_init_templ_addr (decl=0x7ffff7e94da8) at /home/hp/gcctop/tmp/mbase0/gcc/gcc/tree-emutls.c:254 #6 get_emutls_init_templ_addr (decl=0x7ffff7e94da8) at /home/hp/gcctop/tmp/mbase0/gcc/gcc/tree-emutls.c:222 #7 0x0000000000b2eaaf in new_emutls_decl (alias_of=0x0, decl=0x7ffff7e94da8) at /home/hp/gcctop/tmp/mbase0/gcc/gcc/tree-emutls.c:339 #8 create_emultls_var (var=0x7ffff7ea31c0, data=0x7fffffffe888) at /home/hp/gcctop/tmp/mbase0/gcc/gcc/tree-emutls.c:717 #9 0x0000000000d66ccd in varpool_for_node_and_aliases (node=0x7ffff7ea31c0, callback=0xb2e600 <create_emultls_var(varpool_node*, void*)>, data= 0x7fffffffe888, include_overwritable=true) at /home/hp/gcctop/tmp/mbase0/gcc/gcc/varpool.c:682 #10 0x0000000000b2fa58 in ipa_lower_emutls () at /home/hp/gcctop/tmp/mbase0/gcc/gcc/tree-emutls.c:788 #11 (anonymous namespace)::pass_ipa_lower_emutls::execute ( this=<optimized out>) at /home/hp/gcctop/tmp/mbase0/gcc/gcc/tree-emutls.c:849 #12 0x0000000000a54cc8 in execute_one_pass (pass=pass@entry= <opt_pass* 0x142cf80 "emutls"(47)>) at /home/hp/gcctop/tmp/mbase0/gcc/gcc/passes.c:2180 #13 0x0000000000a5569b in execute_ipa_pass_list (pass= <opt_pass* 0x142cf80 "emutls"(47)>) at /home/hp/gcctop/tmp/mbase0/gcc/gcc/passes.c:2571 #14 0x00000000007e8850 in ipa_passes () at /home/hp/gcctop/tmp/mbase0/gcc/gcc/cgraphunit.c:2054 #15 compile () at /home/hp/gcctop/tmp/mbase0/gcc/gcc/cgraphunit.c:2185 #16 0x00000000007e9095 in finalize_compilation_unit () at /home/hp/gcctop/tmp/mbase0/gcc/gcc/cgraphunit.c:2340 #17 0x00000000005cc468 in cp_write_global_declarations () at /home/hp/gcctop/tmp/mbase0/gcc/gcc/cp/decl2.c:4647 #18 0x0000000000ad8485 in compile_file () at /home/hp/gcctop/tmp/mbase0/gcc/gcc/toplev.c:562 #19 0x0000000000ada245 in do_compile () at /home/hp/gcctop/tmp/mbase0/gcc/gcc/toplev.c:1918 #20 toplev_main (argc=17, argv=0x7fffffffec38) at /home/hp/gcctop/tmp/mbase0/gcc/gcc/toplev.c:1994 #21 0x0000003522e21735 in __libc_start_main () from /lib64/libc.so.6 #22 0x00000000004d2495 in _start () (gdb) Author of one or more suspect patches in revision range CC:ed.