https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106124
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P3 |P2 Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org Last reconfirmed| |2023-03-27 Ever confirmed|0 |1 Status|UNCONFIRMED |ASSIGNED --- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- We have (gdb) p debug_tree (type) <record_type 0x7ffff64452a0 ._anon_1 asm_written cxx-odr-p type_5 QI size <integer_cst 0x7ffff628b0c0 type <integer_type 0x7ffff62890a8 bitsizetype> constant 8> ... with TREE_ASM_WRITTEN but not a DIE recorded. For this reason gen_type_die_with_usage does nothing. Earlier we created a DIE for the type but we pruned it as unused later via #0 mark_removed ( die=<dw_die_ref 0x7ffff645c4b0 DW_TAG_structure_type <parent=0x7ffff6296000 DW_TAG_compile_unit>>) at /home/rguenther/src/trunk/gcc/dwarf2out.cc:30245 #1 0x00000000013c291a in prune_unused_types_prune ( die=<dw_die_ref 0x7ffff6296000 DW_TAG_compile_unit>) at /home/rguenther/src/trunk/gcc/dwarf2out.cc:30278 #2 0x00000000013c2c21 in prune_unused_types () at /home/rguenther/src/trunk/gcc/dwarf2out.cc:30363 #3 0x00000000013c8cdb in dwarf2out_early_finish (filename=0x45b83a0 "t.ii") at /home/rguenther/src/trunk/gcc/dwarf2out.cc:32997 we can possibly "fix" that failure to re-create the DIE late by making sure to also clear TREE_ASM_WRITTEN on it. Of course the question is why we have no early DIE for the function <function_decl 0x7ffff6444b00 _FUN type <function_type 0x7ffff629e0a8 ... full-name "static constexpr int A::omp declare reduction x~i(T&)::<lambda()>::_FUN()" I suppose that's the OMP reduction function and that's always(?) inlined? The following fixes the ICE, but as said I wonder why nothing creates a DIE for the function early? I'm going to test this and propose it still. diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index 1711ad2c2da..1a0015ce00f 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -5894,6 +5894,7 @@ lookup_type_die (tree type) if (die && die->removed) { TYPE_SYMTAB_DIE (type) = NULL; + TREE_ASM_WRITTEN (type) = 0; return NULL; } return die;