On Tue, Oct 2, 2018 at 4:18 PM Nathan Sidwell <nat...@acm.org> wrote: > > Ping?
I'm not sure this is the right kind of fix for sth that only triggers with fat objects. My suggestion is to watch the difference to the DIE tree(s) (including the comdat ones) before early-LTO debug write-out (we already have a dumpfile for that, but it doesn't dump the comdat units, see dwarf2out_early_finish) and the state before we finally output for the fat part (just before we call output_comp_unit). I believe we are not properly "undoing" the effect of optimize_external_refs (). That is, I see #4 0x0000000000dcfdd1 in optimize_external_refs_1 ( die=<dw_die_ref 0x7ffff68a9820 DW_TAG_structure_type <parent=0x7ffff68a90a0 DW_TAG_compile_unit>>, map=0x31c1c50) at /tmp/trunk/gcc/dwarf2out.c:8904 8904 ref_p = lookup_external_ref (map, c); (gdb) p debug_dwarf_die (c) DIE 0: DW_TAG_structure_type (0x7ffff68a9a50) abbrev id: 0 offset: 0 mark: 1 DW_AT_name: "integral_constant<bool, false>" DW_AT_signature: die -> signature: 2e365acce74a6a1f (0x7ffff68a92d0) DW_AT_declaration: 1 DW_AT_sibling: die -> 0 (0x7ffff68a9aa0) DIE 0: DW_TAG_typedef (0x7ffff68a9a00) abbrev id: 0 offset: 0 mark: 1 DW_AT_name: "value_type" DW_AT_decl_file: "t.ii" (1) DW_AT_decl_line: 5 DW_AT_decl_column: 15 DW_AT_type: die -> 0 (0x7ffff68a9aa0) $16 = void (gdb) p debug_dwarf_die (die) DIE 0: DW_TAG_structure_type (0x7ffff68a9820) abbrev id: 0 offset: 0 mark: 1 signature: 2e365acce74a6a1f DW_AT_name: "integral_constant<bool, false>" DW_AT_signature: die -> 0 (0x7ffff68a9a50) that looks bougs (a DIE with a signature which has a signature itself). Richard. > On 9/17/18 7:30 AM, Nathan Sidwell wrote: > > Richard, > > this patch makes the ICE go away, but I really don't know if it's > > correct. When cloning the type die I copy die_id, so it is found during > > the (currently ICEing) hash lookup. In this particular testcase we > > clone the die twice. Once from break_out_comdat_types and once from > > copy_decls_for_unworthy_types. That seems a little strange (but I have > > only the smallest understanding of debug data) As these tracebacks show: > > > > Breakpoint 5, clone_as_declaration ( > > die=<dw_die_ref 0x7ffff73262d0 DW_TAG_structure_type > > <parent=0x7ffff73260a0 DW_TAG_compile_unit>>) > > at ../../../src/gcc/dwarf2out.c:8179 > > 8179 clone->die_id = die->die_id; > > (gdb) back > > #0 clone_as_declaration (die=<dw_die_ref 0x7ffff73262d0 > > DW_TAG_structure_type <parent=0x7ffff73260a0 DW_TAG_compile_unit>>) > > at ../../../src/gcc/dwarf2out.c:8179 > > #1 0x0000000000e34faf in generate_skeleton_ancestor_tree > > (node=0x7fffffffe230) at ../../../src/gcc/dwarf2out.c:8345 > > #2 0x0000000000e351c3 in generate_skeleton_bottom_up > > (parent=0x7fffffffe230) at ../../../src/gcc/dwarf2out.c:8419 > > #3 0x0000000000e35291 in generate_skeleton ( > > die=<dw_die_ref 0x7ffff73262d0 DW_TAG_structure_type > > <parent=0x7ffff73260a0 DW_TAG_compile_unit>>) > > at ../../../src/gcc/dwarf2out.c:8449 > > #4 0x0000000000e352ce in remove_child_or_replace_with_skeleton > > (unit=<dw_die_ref 0x7ffff7326780 DW_TAG_type_unit>, > > child=<dw_die_ref 0x7ffff73262d0 DW_TAG_structure_type > > <parent=0x7ffff73260a0 DW_TAG_compile_unit>>, > > prev=<dw_die_ref 0x7ffff7326550 DW_TAG_pointer_type > > <parent=0x7ffff73260a0 DW_TAG_compile_unit>>) > > at ../../../src/gcc/dwarf2out.c:8471 > > #5 0x0000000000e3570a in break_out_comdat_types (die=<dw_die_ref > > 0x7ffff73260a0 DW_TAG_compile_unit>) > > at ../../../src/gcc/dwarf2out.c:8636 > > #6 0x0000000000e75153 in dwarf2out_early_finish (filename=0x34de9d0 > > "bug.ii") at ../../../src/gcc/dwarf2out.c:32034 > > #7 0x0000000000daa210 in symbol_table::finalize_compilation_unit > > (this=0x7ffff730d100) at ../../../src/gcc/cgraphunit.c:2783 > > #8 0x0000000001417ec2 in compile_file () at ../../../src/gcc/toplev.c:480 > > #9 0x000000000141a90c in do_compile () at ../../../src/gcc/toplev.c:2170 > > #10 0x000000000141abf8 in toplev::main (this=0x7fffffffe56e, argc=8, > > argv=0x7fffffffe668) at ../../../src/gcc/toplev.c:2305 > > #11 0x000000000227731e in main (argc=8, argv=0x7fffffffe668) at > > ../../../src/gcc/main.c:39 > > (gdb) p clone > > $2 = <dw_die_ref 0x7ffff7326820 DW_TAG_structure_type> > > (gdb) c > > Continuing. > > > > Breakpoint 5, clone_as_declaration (die=<dw_die_ref 0x7ffff73262d0 > > DW_TAG_structure_type <parent=0x7ffff7326780 DW_TAG_type_unit>>) > > at ../../../src/gcc/dwarf2out.c:8179 > > 8179 clone->die_id = die->die_id; > > (gdb) p clone > > $3 = <dw_die_ref 0x7ffff7326a50 DW_TAG_structure_type> > > (gdb) back > > #0 clone_as_declaration (die=<dw_die_ref 0x7ffff73262d0 > > DW_TAG_structure_type <parent=0x7ffff7326780 DW_TAG_type_unit>>) > > at ../../../src/gcc/dwarf2out.c:8179 > > #1 0x0000000000e34dac in copy_ancestor_tree (unit=<dw_die_ref > > 0x7ffff73260a0 DW_TAG_compile_unit>, > > die=<dw_die_ref 0x7ffff73262d0 DW_TAG_structure_type > > <parent=0x7ffff7326780 DW_TAG_type_unit>>, decl_table=0x7fffffffe2f0) > > at ../../../src/gcc/dwarf2out.c:8267 > > #2 0x0000000000e35adb in copy_decls_walk (unit=<dw_die_ref > > 0x7ffff73260a0 DW_TAG_compile_unit>, > > die=<dw_die_ref 0x7ffff73264b0 DW_TAG_subprogram > > <parent=0x7ffff7326820 DW_TAG_structure_type>>, decl_table=0x7fffffffe2f0) > > at ../../../src/gcc/dwarf2out.c:8764 > > #3 0x0000000000e35ba6 in copy_decls_walk (unit=<dw_die_ref > > 0x7ffff73260a0 DW_TAG_compile_unit>, > > die=<dw_die_ref 0x7ffff7326820 DW_TAG_structure_type > > <parent=0x7ffff73260a0 DW_TAG_compile_unit>>, decl_table=0x7fffffffe2f0) > > at ../../../src/gcc/dwarf2out.c:8790 > > #4 0x0000000000e35ba6 in copy_decls_walk (unit=<dw_die_ref > > 0x7ffff73260a0 DW_TAG_compile_unit>, > > die=<dw_die_ref 0x7ffff73260a0 DW_TAG_compile_unit>, > > decl_table=0x7fffffffe2f0) at ../../../src/gcc/dwarf2out.c:8790 > > #5 0x0000000000e35c09 in copy_decls_for_unworthy_types > > (unit=<dw_die_ref 0x7ffff73260a0 DW_TAG_compile_unit>) > > at ../../../src/gcc/dwarf2out.c:8804 > > #6 0x0000000000e7519a in dwarf2out_early_finish (filename=0x34de9d0 > > "bug.ii") at ../../../src/gcc/dwarf2out.c:32047 > > #7 0x0000000000daa210 in symbol_table::finalize_compilation_unit > > (this=0x7ffff730d100) at ../../../src/gcc/cgraphunit.c:2783 > > #8 0x0000000001417ec2 in compile_file () at ../../../src/gcc/toplev.c:480 > > #9 0x000000000141a90c in do_compile () at ../../../src/gcc/toplev.c:2170 > > #10 0x000000000141abf8 in toplev::main (this=0x7fffffffe56e, argc=8, > > argv=0x7fffffffe668) at ../../../src/gcc/toplev.c:2305 > > #11 0x000000000227731e in main (argc=8, argv=0x7fffffffe668) at > > ../../../src/gcc/main.c:39 > > (gdb) > > > > > > > -- > Nathan Sidwell