http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58555
--- Comment #8 from octoploid at yandex dot com --- The following patch seems to fix the issue: diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index f4cb72a9c2b0..b69d4d96176a 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -698,7 +698,7 @@ want_inline_self_recursive_call_p (struct cgraph_edge *edge, reason = "profile of recursive call is too large"; want_inline = false; } - if (!max_count + if (!max_count && caller_freq && (edge->frequency * CGRAPH_FREQ_BASE / caller_freq >= max_prob)) { @@ -731,7 +731,7 @@ want_inline_self_recursive_call_p (struct cgraph_edge *edge, reason = "profile of recursive call is too small"; want_inline = false; } - else if (!max_count + else if (!max_count && caller_freq && (edge->frequency * 100 / caller_freq <= PARAM_VALUE (PARAM_MIN_INLINE_RECURSIVE_PROBABILITY)))