[Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p

dcb314 at hotmail dot com gcc-bugzilla@gcc.gnu.org
Thu Jan 9 09:33:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58555

--- Comment #15 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to David Binderman from comment #14)
> (In reply to Jan Hubicka from comment #13)
> > I see, we should just short citcuit case when caller_freq
> > is 0.  I will test patch.
> 
> Any news with the patch ?

I looked into this some more and there are four
places in the same function where it is assumed
that for X / Y, that Y is always != 0.

Belt'n'braces programming suggests it might be a
wise idea to sanity check all four places.

I am current using this diff.

Index: src/trunk/gcc/ipa-inline.c
===================================================================
--- src/trunk/gcc/ipa-inline.c    (revision 206420)
+++ src/trunk/gcc/ipa-inline.c    (working copy)
@@ -703,6 +703,7 @@
       for (i = 1; i < depth; i++)
     max_prob = max_prob * max_prob / CGRAPH_FREQ_BASE;
       if (max_count
+          && outer_node->count != 0
       && (edge->count * CGRAPH_FREQ_BASE / outer_node->count
           >= max_prob))
     {
@@ -710,6 +711,7 @@
       want_inline = false;
     }
       if (!max_count
+          && caller_freq != 0
       && (edge->frequency * CGRAPH_FREQ_BASE / caller_freq
           >= max_prob))
     {
@@ -736,6 +738,7 @@
   else
     {
       if (max_count
+          && outer_node->count != 0
       && (edge->count * 100 / outer_node->count
           <= PARAM_VALUE (PARAM_MIN_INLINE_RECURSIVE_PROBABILITY)))
     {
@@ -743,6 +746,7 @@
       want_inline = false;
     }
       else if (!max_count
+               && caller_freq != 0
            && (edge->frequency * 100 / caller_freq
                <= PARAM_VALUE (PARAM_MIN_INLINE_RECURSIVE_PROBABILITY)))
     {



More information about the Gcc-bugs mailing list