https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103058
--- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> --- (In reply to Jan Hubicka from comment #6) > Looking at the particular ICE, this looks like a fortran frond-end issue - > this is during compilation and not during link and I do not see why Fortran > should produce nested function with external linkage. > I comitted a patch that silences the ICE, but it would be nice to make the > function static for Fortran. > > Changing component to fortran. Looking at the symbol with the following patch: diff --git a/gcc/cgraph.c b/gcc/cgraph.c index de078653781..58112901bfe 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -2203,6 +2203,10 @@ cgraph_node::dump (FILE *f) fprintf (f, " %soperator_delete", DECL_IS_REPLACEABLE_OPERATOR (decl) ? "replaceable_" : ""); + function *fn = DECL_STRUCT_FUNCTION (decl); + if (fn != NULL && fn->static_chain_decl) + fprintf (f, " has_static_chain_decl"); + fprintf (f, "\n"); if (thunk) Compiled in quicksort.fppized.f90.000i.cgraph: quick_sort_1.1/2 (quick_sort_1) @0x7ffff7669550 Type: function definition analyzed Visibility: Aux: @0x28f9d40 References: Referring: Function flags: body has_static_chain_decl Called by: quick_sort_1.1/2 quick_sort_1.1/2 __quicksort_MOD_quick_sort/1 Calls: quick_sort_1.1/2 quick_sort_1.1/2 interchange_sort.0/0 Then when the LTRANS ICE happens, I see: (gdb) p node->debug() quick_sort_1.1.lto_priv.0/213 (quick_sort_1) @0x7ffff7499cc0 Type: function Body removed by symtab_remove_unreachable_nodes Visibility: in_other_partition prevailing_def_ironly external public visibility_specified visibility:hidden References: Referring: Availability: local Unit id: 3 Function flags: count:19391457 (estimated locally) local nonfreeing_fn Called by: Calls: Does it really have the external linkage?