https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65130
--- Comment #11 from Jan Hubicka <hubicka at ucw dot cz> --- Hi, the bug is caused by code inlining functions called once. Here is a dead self recursive function that is called once (from itself) and the inliner manages to not punt on the rcurisve call and produce cycle. The following patch ought to fix it. Index: ipa-inline-analysis.c =================================================================== --- ipa-inline-analysis.c (revision 221096) +++ ipa-inline-analysis.c (working copy) @@ -1291,7 +1291,8 @@ inline_summary_t::duplicate (cgraph_node set_hint_predicate (&info->array_index, p); } } - inline_update_overall_summary (dst); + if (!dst->global.inlined_to) + inline_update_overall_summary (dst); } @@ -3924,10 +3925,11 @@ do_estimate_growth_1 (struct cgraph_node continue; } - if (e->caller == d->node - || (e->caller->global.inlined_to - && e->caller->global.inlined_to == d->node)) - d->self_recursive = true; + if (e->recursive_p ()) + { + d->self_recursive = true; + continue; + } d->growth += estimate_edge_growth (e); } return false; Index: ipa-inline.c =================================================================== --- ipa-inline.c (revision 221096) +++ ipa-inline.c (working copy) @@ -952,6 +952,8 @@ check_callers (struct cgraph_node *node, return true; if (!can_inline_edge_p (e, true)) return true; + if (e->recursive_p ()) + return true; if (!(*(bool *)has_hot_call) && e->maybe_hot_p ()) *(bool *)has_hot_call = true; } @@ -2094,6 +2096,15 @@ inline_to_all_callers (struct cgraph_nod { struct cgraph_node *caller = node->callers->caller; + if (!can_inline_edge_p (node->callers, true) + || node->callers->recursive_p ()) + { + if (dump_file) + fprintf (dump_file, "Uninlinable call found; giving up.\n"); + *num_calls = 0; + return false; + } + if (dump_file) { fprintf (dump_file,