public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p
@ 2013-09-27 19:19 dcb314 at hotmail dot com
  2013-09-27 21:04 ` [Bug c++/58555] " markus at trippelsdorf dot de
                   ` (29 more replies)
  0 siblings, 30 replies; 31+ messages in thread
From: dcb314 at hotmail dot com @ 2013-09-27 19:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58555
           Summary: Floating point exception in
                    want_inline_self_recursive_call_p
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com

Created attachment 30919
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30919&action=edit
gzipped C++ source code

I just tried to compile package flamerobin-0.9.3-4.20130401snap with
gcc 4.9 trunk dated 20130925. It said

./src/metadata/root.cpp:375:1: internal compiler error: Floating point
exception
 }
 ^
0xafbfff crash_signal
    ../../src/trunk/gcc/toplev.c:335
0x50ed95 want_inline_self_recursive_call_p
    ../../src/trunk/gcc/ipa-inline.c:699
0xf72320 inline_small_functions
    ../../src/trunk/gcc/ipa-inline.c:1756
0xf72320 ipa_inline
    ../../src/trunk/gcc/ipa-inline.c:2009
0xf72320 execute
    ../../src/trunk/gcc/ipa-inline.c:2379
Please submit a full bug report,
with preprocessed source if appropriate.

Preprocessed source code attached. Flag -O3 required.

Checking the compiler source code, the offending line is

      if (!max_count
      && (edge->frequency * CGRAPH_FREQ_BASE / caller_freq
          >= max_prob))

I speculate that caller_freq == 0 and someone has missed out
a belt'n'braces check for zero before making the division.


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c++/58555] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
@ 2013-09-27 21:04 ` markus at trippelsdorf dot de
  2013-09-28 11:36 ` paolo.carlini at oracle dot com
                   ` (28 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: markus at trippelsdorf dot de @ 2013-09-27 21:04 UTC (permalink / raw)
  To: gcc-bugs

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

Markus Trippelsdorf <markus at trippelsdorf dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |markus at trippelsdorf dot de

--- Comment #1 from Markus Trippelsdorf <markus at trippelsdorf dot de> ---
Created attachment 30920
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30920&action=edit
reduced testcase


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c++/58555] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
  2013-09-27 21:04 ` [Bug c++/58555] " markus at trippelsdorf dot de
@ 2013-09-28 11:36 ` paolo.carlini at oracle dot com
  2013-09-28 11:52 ` markus at trippelsdorf dot de
                   ` (27 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-09-28 11:36 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at ucw dot cz

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I think this is for Honza


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug c++/58555] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
  2013-09-27 21:04 ` [Bug c++/58555] " markus at trippelsdorf dot de
  2013-09-28 11:36 ` paolo.carlini at oracle dot com
@ 2013-09-28 11:52 ` markus at trippelsdorf dot de
  2013-09-30 10:25 ` [Bug middle-end/58555] [4.9 Regression] " rguenth at gcc dot gnu.org
                   ` (26 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: markus at trippelsdorf dot de @ 2013-09-28 11:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Markus Trippelsdorf <markus at trippelsdorf dot de> ---
(In reply to Paolo Carlini from comment #2)
> I think this is for Honza

Yes. Started with r202185 .


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2013-09-28 11:52 ` markus at trippelsdorf dot de
@ 2013-09-30 10:25 ` rguenth at gcc dot gnu.org
  2013-09-30 10:54 ` mpolacek at gcc dot gnu.org
                   ` (25 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-09-30 10:25 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |middle-end
   Target Milestone|---                         |4.9.0
            Summary|Floating point exception in |[4.9 Regression] Floating
                   |want_inline_self_recursive_ |point exception in
                   |call_p                      |want_inline_self_recursive_
                   |                            |call_p


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  2013-09-30 10:25 ` [Bug middle-end/58555] [4.9 Regression] " rguenth at gcc dot gnu.org
@ 2013-09-30 10:54 ` mpolacek at gcc dot gnu.org
  2013-10-17  9:46 ` dcb314 at hotmail dot com
                   ` (24 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-09-30 10:54 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-09-30
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Thus confirmed.


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (4 preceding siblings ...)
  2013-09-30 10:54 ` mpolacek at gcc dot gnu.org
@ 2013-10-17  9:46 ` dcb314 at hotmail dot com
  2013-11-05 14:42 ` rguenth at gcc dot gnu.org
                   ` (23 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: dcb314 at hotmail dot com @ 2013-10-17  9:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to Marek Polacek from comment #4)
> Thus confirmed.

Still broken in trunk dated 20131016.


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (5 preceding siblings ...)
  2013-10-17  9:46 ` dcb314 at hotmail dot com
@ 2013-11-05 14:42 ` rguenth at gcc dot gnu.org
  2013-11-05 15:17 ` octoploid at yandex dot com
                   ` (22 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-05 14:42 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (6 preceding siblings ...)
  2013-11-05 14:42 ` rguenth at gcc dot gnu.org
@ 2013-11-05 15:17 ` octoploid at yandex dot com
  2013-11-05 16:23 ` octoploid at yandex dot com
                   ` (21 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: octoploid at yandex dot com @ 2013-11-05 15:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from octoploid at yandex dot com ---
Program received signal SIGFPE, Arithmetic exception.
[Switching to process 21235]
0x000000000052531d in want_inline_self_recursive_call_p (edge=0x7ffff74412d8,
outer_node=0x7ffff7442260, peeling=<optimized out>, depth=1) at
../../gcc/gcc/ipa-inline.c:702
702               && (edge->frequency * CGRAPH_FREQ_BASE / caller_freq
(gdb) bt
#0  0x000000000052531d in want_inline_self_recursive_call_p
(edge=0x7ffff74412d8, outer_node=0x7ffff7442260, peeling=<optimized out>,
depth=1)
    at ../../gcc/gcc/ipa-inline.c:702
#1  0x0000000000fca3bb in inline_small_functions () at
../../gcc/gcc/ipa-inline.c:1761
#2  ipa_inline () at ../../gcc/gcc/ipa-inline.c:2015
#3  (anonymous namespace)::pass_ipa_inline::execute (this=0x7ffff74412d8) at
../../gcc/gcc/ipa-inline.c:2385
#4  0x0000000000a6ad8a in execute_one_pass (pass=pass@entry=0x16c5520) at
../../gcc/gcc/passes.c:2215
#5  0x0000000000a6b61b in execute_ipa_pass_list (pass=0x16c5520) at
../../gcc/gcc/passes.c:2579
#6  0x000000000080e287 in ipa_passes () at ../../gcc/gcc/cgraphunit.c:2028
#7  compile () at ../../gcc/gcc/cgraphunit.c:2118
#8  0x000000000080ea95 in finalize_compilation_unit () at
../../gcc/gcc/cgraphunit.c:2272
#9  0x000000000061175f in cp_write_global_declarations () at
../../gcc/gcc/cp/decl2.c:4403
#10 0x0000000000b152dd in compile_file () at ../../gcc/gcc/toplev.c:559
#11 0x0000000000b17188 in do_compile () at ../../gcc/gcc/toplev.c:1894
#12 toplev_main (argc=13, argv=0x7fffffffe308) at ../../gcc/gcc/toplev.c:1970
#13 0x00007ffff75fba6e in __libc_start_main () from /lib/libc.so.6
#14 0x0000000000527081 in _start ()
(gdb) p caller_freq
$1 = 0
(gdb) p outer_node->global.inlined_to
$2 = (cgraph_node *) 0x7ffff73ff980
(gdb) p outer_node->callers->frequency
$3 = 0


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (7 preceding siblings ...)
  2013-11-05 15:17 ` octoploid at yandex dot com
@ 2013-11-05 16:23 ` octoploid at yandex dot com
  2013-11-05 19:29 ` octoploid at yandex dot com
                   ` (20 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: octoploid at yandex dot com @ 2013-11-05 16:23 UTC (permalink / raw)
  To: gcc-bugs

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

octoploid at yandex dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #30920|0                           |1
        is obsolete|                            |

--- Comment #7 from octoploid at yandex dot com ---
Created attachment 31162
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31162&action=edit
reduced testcase

Here's a better reduced testcase. The first one was crappy.


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (8 preceding siblings ...)
  2013-11-05 16:23 ` octoploid at yandex dot com
@ 2013-11-05 19:29 ` octoploid at yandex dot com
  2013-11-13 14:05 ` dcb314 at hotmail dot com
                   ` (19 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: octoploid at yandex dot com @ 2013-11-05 19:29 UTC (permalink / raw)
  To: gcc-bugs

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)))


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (9 preceding siblings ...)
  2013-11-05 19:29 ` octoploid at yandex dot com
@ 2013-11-13 14:05 ` dcb314 at hotmail dot com
  2013-11-13 15:20 ` octoploid at yandex dot com
                   ` (18 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: dcb314 at hotmail dot com @ 2013-11-13 14:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to Markus Trippelsdorf from comment #8)
> The following patch seems to fix the issue:

Looks good to me. 

I think it needs to get into the compiler source code somehow.

Would posting the patch to gcc-patches be the correct way forward ?


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (10 preceding siblings ...)
  2013-11-13 14:05 ` dcb314 at hotmail dot com
@ 2013-11-13 15:20 ` octoploid at yandex dot com
  2013-12-04 15:29 ` jakub at gcc dot gnu.org
                   ` (17 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: octoploid at yandex dot com @ 2013-11-13 15:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Markus Trippelsdorf <octoploid at yandex dot com> ---
(In reply to David Binderman from comment #9)
> (In reply to Markus Trippelsdorf from comment #8)
> > The following patch seems to fix the issue:
> 
> Looks good to me. 
> 
> I think it needs to get into the compiler source code somehow.
> 
> Would posting the patch to gcc-patches be the correct way forward ?

Yes, but I'd prefer not to. Because without commit rights you'll
have to find someone to commit things for you. And the need to 
repeatedly ping even for trivial patches soon gets ridiculous.


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (11 preceding siblings ...)
  2013-11-13 15:20 ` octoploid at yandex dot com
@ 2013-12-04 15:29 ` jakub at gcc dot gnu.org
  2013-12-04 15:56 ` octoploid at yandex dot com
                   ` (16 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-12-04 15:29 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Can't reproduce this, with various snapshots from around the date of comments,
or current trunk, neither on the larger nor shorter testcase.


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (12 preceding siblings ...)
  2013-12-04 15:29 ` jakub at gcc dot gnu.org
@ 2013-12-04 15:56 ` octoploid at yandex dot com
  2013-12-04 18:04 ` hubicka at ucw dot cz
                   ` (15 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: octoploid at yandex dot com @ 2013-12-04 15:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Markus Trippelsdorf <octoploid at yandex dot com> ---
(In reply to Jakub Jelinek from comment #11)
> Can't reproduce this, with various snapshots from around the date of
> comments, or current trunk, neither on the larger nor shorter testcase.

Strange.
Just double checked and it still ICEs for me:
  % ../gcc/configure --disable-bootstrap --disable-libvtv --disable-libitm
--disable-libcilkrts --disable-libssp --disable-libgomp --disable-werror
--disable-multilib --enable-languages=c,c++
  % make -j4 && make DESTDIR=/var/tmp/gcc_test install
  % /var/tmp/gcc_test/usr/local/bin/g++ -O3 -c test.ii
test.ii:113:35: internal compiler error: Floating point exception
 void addServer() { I<int>(new P); }
                                   ^
0xb44e9f crash_signal
        ../../gcc/gcc/toplev.c:336
0x53c863 want_inline_self_recursive_call_p
        ../../gcc/gcc/ipa-inline.c:708
0x1023819 inline_small_functions
        ../../gcc/gcc/ipa-inline.c:1767
0x1023819 ipa_inline
        ../../gcc/gcc/ipa-inline.c:2020
0x1023819 execute
        ../../gcc/gcc/ipa-inline.c:2390
Please submit a full bug report,
with preprocessed source if appro


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (13 preceding siblings ...)
  2013-12-04 15:56 ` octoploid at yandex dot com
@ 2013-12-04 18:04 ` hubicka at ucw dot cz
  2014-01-02  9:31 ` dcb314 at hotmail dot com
                   ` (14 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: hubicka at ucw dot cz @ 2013-12-04 18:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Jan Hubicka <hubicka at ucw dot cz> ---
I see, we should just short citcuit case when caller_freq
is 0.  I will test patch.


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (14 preceding siblings ...)
  2013-12-04 18:04 ` hubicka at ucw dot cz
@ 2014-01-02  9:31 ` dcb314 at hotmail dot com
  2014-01-09  9:33 ` dcb314 at hotmail dot com
                   ` (13 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: dcb314 at hotmail dot com @ 2014-01-02  9:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from David Binderman <dcb314 at hotmail dot com> ---
(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 ?


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (15 preceding siblings ...)
  2014-01-02  9:31 ` dcb314 at hotmail dot com
@ 2014-01-09  9:33 ` dcb314 at hotmail dot com
  2014-01-27 20:41 ` law at redhat dot com
                   ` (12 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: dcb314 at hotmail dot com @ 2014-01-09  9:33 UTC (permalink / raw)
  To: gcc-bugs

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)))
     {


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (16 preceding siblings ...)
  2014-01-09  9:33 ` dcb314 at hotmail dot com
@ 2014-01-27 20:41 ` law at redhat dot com
  2014-01-27 20:54 ` law at redhat dot com
                   ` (11 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: law at redhat dot com @ 2014-01-27 20:41 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at redhat dot com

--- Comment #16 from Jeffrey A. Law <law at redhat dot com> ---
I haven't managed to reproduce this either.  Clearly Jakub and I are doing
something different that's preventing us from reproducing this problem.

I don't want to just go forward with the patch that checks that the denominator
is nonzero without knowing more about how/why it is zero.  Much like a NULL
pointer dereference, this specific failure may well be just the manifestation
of a problem elsewhere.

David, Markus -- can y'all reproduce on one of the gcc farm machines?  Or a VM
you can give me access to?   Or at least a core file and corresponding svn
revision for the GCC build you're using?


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (17 preceding siblings ...)
  2014-01-27 20:41 ` law at redhat dot com
@ 2014-01-27 20:54 ` law at redhat dot com
  2014-01-27 21:23 ` hubicka at gcc dot gnu.org
                   ` (10 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: law at redhat dot com @ 2014-01-27 20:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from Jeffrey A. Law <law at redhat dot com> ---
Nevermind, I've got it failing now.


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (18 preceding siblings ...)
  2014-01-27 20:54 ` law at redhat dot com
@ 2014-01-27 21:23 ` hubicka at gcc dot gnu.org
  2014-01-27 21:27 ` law at redhat dot com
                   ` (9 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: hubicka at gcc dot gnu.org @ 2014-01-27 21:23 UTC (permalink / raw)
  To: gcc-bugs

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

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |hubicka at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |hubicka at gcc dot gnu.org

--- Comment #18 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
When caller frequency is 0, we do not really want to inline recursively.  I
will make a patch.


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (19 preceding siblings ...)
  2014-01-27 21:23 ` hubicka at gcc dot gnu.org
@ 2014-01-27 21:27 ` law at redhat dot com
  2014-01-27 21:41 ` hubicka at ucw dot cz
                   ` (8 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: law at redhat dot com @ 2014-01-27 21:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #19 from Jeffrey A. Law <law at redhat dot com> ---
That part is pretty obvious.  What I wanted to look at is how we got there and
did it make any sense to be in that code with a caller frequency of zero.


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (20 preceding siblings ...)
  2014-01-27 21:27 ` law at redhat dot com
@ 2014-01-27 21:41 ` hubicka at ucw dot cz
  2014-01-27 21:52 ` law at redhat dot com
                   ` (7 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: hubicka at ucw dot cz @ 2014-01-27 21:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #20 from Jan Hubicka <hubicka at ucw dot cz> ---
> That part is pretty obvious.  What I wanted to look at is how we got there and
> did it make any sense to be in that code with a caller frequency of zero.

Recursive inliner will happily call the predicate on every recursive call it is
given.  Usually we do not get there, because in those cases we get
!cgraph_maybe_hot_edge_p

That predicate however can be convinced to return true even for calls with
0 frequency if profile feedback says there are stil many counts or if user
drops hot attribute on the outer function. (Theresa made this code to depends
on edge historgram and in some cases it may behave in funy ways).
So check is needed.

Question remains why this reproduces on testcase without profile feedback & hot
attribute.  I assume that because roundoff error We have A inlined in B with
call frequency 0 while A still have callees with non-zero frequency because it
contains a loop.  It is apparently what happens here, will double check.


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (21 preceding siblings ...)
  2014-01-27 21:41 ` hubicka at ucw dot cz
@ 2014-01-27 21:52 ` law at redhat dot com
  2014-02-18  6:37 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: law at redhat dot com @ 2014-01-27 21:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #21 from Jeffrey A. Law <law at redhat dot com> ---
Right, I'd been speculating that we were calling
want_inline_self_recursive_call_p for all self-recursive calls and that maybe
the hot edge or other heuristic was doing something unexpected.

Anyway, I'll let you run with it.  You'll be far more efficient than I nailing
this down.  I only started looking at it because it was one of the P1s with no
activity for the longest time.

jeff


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (22 preceding siblings ...)
  2014-01-27 21:52 ` law at redhat dot com
@ 2014-02-18  6:37 ` jakub at gcc dot gnu.org
  2014-02-18  8:26 ` dcb314 at hotmail dot com
                   ` (5 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-02-18  6:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #22 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, shall we just apply #c15 here?


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (23 preceding siblings ...)
  2014-02-18  6:37 ` jakub at gcc dot gnu.org
@ 2014-02-18  8:26 ` dcb314 at hotmail dot com
  2014-02-20  6:15 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: dcb314 at hotmail dot com @ 2014-02-18  8:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #23 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to Jakub Jelinek from comment #22)
> So, shall we just apply #c15 here?

Diff works fine for me for over five weeks now, so I say yes.


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (24 preceding siblings ...)
  2014-02-18  8:26 ` dcb314 at hotmail dot com
@ 2014-02-20  6:15 ` jakub at gcc dot gnu.org
  2014-02-20  6:22 ` trippels at gcc dot gnu.org
                   ` (3 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-02-20  6:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #26 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Thanks, but please fix the typoes:
s/ulikely/unlikely/
s/appers/appears/
s/bookeeping/bookkeeping/
?


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (25 preceding siblings ...)
  2014-02-20  6:15 ` jakub at gcc dot gnu.org
@ 2014-02-20  6:22 ` trippels at gcc dot gnu.org
  2014-02-20  6:25 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: trippels at gcc dot gnu.org @ 2014-02-20  6:22 UTC (permalink / raw)
  To: gcc-bugs

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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |trippels at gcc dot gnu.org

--- Comment #27 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #26)
> Thanks, but please fix the typoes:

s/typoes/typos


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (26 preceding siblings ...)
  2014-02-20  6:22 ` trippels at gcc dot gnu.org
@ 2014-02-20  6:25 ` jakub at gcc dot gnu.org
  2014-02-20  6:40 ` hubicka at gcc dot gnu.org
  2014-02-20  7:43 ` trippels at gcc dot gnu.org
  29 siblings, 0 replies; 31+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-02-20  6:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #28 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Markus Trippelsdorf from comment #27)
> s/typoes/typos

;)


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (27 preceding siblings ...)
  2014-02-20  6:25 ` jakub at gcc dot gnu.org
@ 2014-02-20  6:40 ` hubicka at gcc dot gnu.org
  2014-02-20  7:43 ` trippels at gcc dot gnu.org
  29 siblings, 0 replies; 31+ messages in thread
From: hubicka at gcc dot gnu.org @ 2014-02-20  6:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #29 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Author: hubicka
Date: Thu Feb 20 06:40:07 2014
New Revision: 207934

URL: http://gcc.gnu.org/viewcvs?rev=207934&root=gcc&view=rev
Log:

    PR ipa/58555
    * ipa-inline-transform.c (clone_inlined_nodes): Add freq_scale parameter
    specifying the scaling.
    (inline_call): Update.
    (want_inline_recursively): Guard division by zero.
    (recursive_inlining): Update.
    * ipa-inline.h (clone_inlined_nodes): Update.
    * testsuite/g++.dg/torture/pr58555.C: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/torture/pr58555.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ipa-inline-transform.c
    trunk/gcc/ipa-inline.c
    trunk/gcc/ipa-inline.h
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [Bug middle-end/58555] [4.9 Regression] Floating point exception in want_inline_self_recursive_call_p
  2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
                   ` (28 preceding siblings ...)
  2014-02-20  6:40 ` hubicka at gcc dot gnu.org
@ 2014-02-20  7:43 ` trippels at gcc dot gnu.org
  29 siblings, 0 replies; 31+ messages in thread
From: trippels at gcc dot gnu.org @ 2014-02-20  7:43 UTC (permalink / raw)
  To: gcc-bugs

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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #30 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Fixed. Thanks.


^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2014-02-20  7:43 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-27 19:19 [Bug c++/58555] New: Floating point exception in want_inline_self_recursive_call_p dcb314 at hotmail dot com
2013-09-27 21:04 ` [Bug c++/58555] " markus at trippelsdorf dot de
2013-09-28 11:36 ` paolo.carlini at oracle dot com
2013-09-28 11:52 ` markus at trippelsdorf dot de
2013-09-30 10:25 ` [Bug middle-end/58555] [4.9 Regression] " rguenth at gcc dot gnu.org
2013-09-30 10:54 ` mpolacek at gcc dot gnu.org
2013-10-17  9:46 ` dcb314 at hotmail dot com
2013-11-05 14:42 ` rguenth at gcc dot gnu.org
2013-11-05 15:17 ` octoploid at yandex dot com
2013-11-05 16:23 ` octoploid at yandex dot com
2013-11-05 19:29 ` octoploid at yandex dot com
2013-11-13 14:05 ` dcb314 at hotmail dot com
2013-11-13 15:20 ` octoploid at yandex dot com
2013-12-04 15:29 ` jakub at gcc dot gnu.org
2013-12-04 15:56 ` octoploid at yandex dot com
2013-12-04 18:04 ` hubicka at ucw dot cz
2014-01-02  9:31 ` dcb314 at hotmail dot com
2014-01-09  9:33 ` dcb314 at hotmail dot com
2014-01-27 20:41 ` law at redhat dot com
2014-01-27 20:54 ` law at redhat dot com
2014-01-27 21:23 ` hubicka at gcc dot gnu.org
2014-01-27 21:27 ` law at redhat dot com
2014-01-27 21:41 ` hubicka at ucw dot cz
2014-01-27 21:52 ` law at redhat dot com
2014-02-18  6:37 ` jakub at gcc dot gnu.org
2014-02-18  8:26 ` dcb314 at hotmail dot com
2014-02-20  6:15 ` jakub at gcc dot gnu.org
2014-02-20  6:22 ` trippels at gcc dot gnu.org
2014-02-20  6:25 ` jakub at gcc dot gnu.org
2014-02-20  6:40 ` hubicka at gcc dot gnu.org
2014-02-20  7:43 ` trippels at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).