public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/54458] New: get_loop_body, at cfgloop.c:830
@ 2012-09-02 15:38 francesco.zappa.nardelli at gmail dot com
  2012-09-02 15:42 ` [Bug tree-optimization/54458] ICE " francesco.zappa.nardelli at gmail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: francesco.zappa.nardelli at gmail dot com @ 2012-09-02 15:38 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 54458
           Summary: get_loop_body, at cfgloop.c:830
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: francesco.zappa.nardelli@gmail.com


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

* [Bug tree-optimization/54458] ICE get_loop_body, at cfgloop.c:830
  2012-09-02 15:38 [Bug tree-optimization/54458] New: get_loop_body, at cfgloop.c:830 francesco.zappa.nardelli at gmail dot com
@ 2012-09-02 15:42 ` francesco.zappa.nardelli at gmail dot com
  2012-09-02 16:23 ` francesco.zappa.nardelli at gmail dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: francesco.zappa.nardelli at gmail dot com @ 2012-09-02 15:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Francesco Zappa Nardelli <francesco.zappa.nardelli at gmail dot com> 2012-09-02 15:42:45 UTC ---
$ gcc -v       
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/yquem/moscova/zappa/source/gcc-svn-bin/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-svn/configure
--prefix=/home/yquem/moscova/zappa/source/gcc-svn-bin/
Thread model: posix
gcc version 4.8.0 20120627 (experimental) (GCC) 

[a recent but not the latest svn trunk]

$ cat input.c

int a, b, c, d;
void
func_34 () {
lbl_424:
  if (c ? 0 : 0 % 0)
    for (; a; a--)
lbl_130: {
    }
  else if (d)
    for (;;) {
    }
  if (b)
    goto lbl_130;
  goto lbl_424;
}
void
main () {
}

$ gcc -O3 input.c
input.c: In function 'func_34':
input.c:5:17: warning: division by zero [-Wdiv-by-zero]
   if (c ? 0 : 0 % 0)
                 ^
input.c:3:1: internal compiler error: in get_loop_body, at cfgloop.c:830
 func_34 () {
 ^
Please submit a full bug report.


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

* [Bug tree-optimization/54458] ICE get_loop_body, at cfgloop.c:830
  2012-09-02 15:38 [Bug tree-optimization/54458] New: get_loop_body, at cfgloop.c:830 francesco.zappa.nardelli at gmail dot com
  2012-09-02 15:42 ` [Bug tree-optimization/54458] ICE " francesco.zappa.nardelli at gmail dot com
@ 2012-09-02 16:23 ` francesco.zappa.nardelli at gmail dot com
  2012-09-02 17:05 ` [Bug tree-optimization/54458] [4.8 Regression] " hjl.tools at gmail dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: francesco.zappa.nardelli at gmail dot com @ 2012-09-02 16:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Francesco Zappa Nardelli <francesco.zappa.nardelli at gmail dot com> 2012-09-02 16:23:35 UTC ---
Can reproduce with the latest svn trunk as well:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/yquem/moscova/zappa/source/gcc-svn-bin/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-svn/configure --disable-bootstrap
--enable-languages=c,c++ --prefix=/home/yquem/moscova/zappa/source/gcc-svn-bin
: (reconfigured) ../gcc-svn/configure --disable-bootstrap --enable-languages=c
--prefix=/home/yquem/moscova/zappa/source/gcc-svn-bin
Thread model: posix
gcc version 4.8.0 20120902 (experimental) (GCC) 

and the exact error message now is:

input.c:3:1: internal compiler error: in get_loop_body, at cfgloop.c:823
 func_34 () {
 ^
Please submit a full bug report.


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

* [Bug tree-optimization/54458] [4.8 Regression] ICE get_loop_body, at cfgloop.c:830
  2012-09-02 15:38 [Bug tree-optimization/54458] New: get_loop_body, at cfgloop.c:830 francesco.zappa.nardelli at gmail dot com
  2012-09-02 15:42 ` [Bug tree-optimization/54458] ICE " francesco.zappa.nardelli at gmail dot com
  2012-09-02 16:23 ` francesco.zappa.nardelli at gmail dot com
@ 2012-09-02 17:05 ` hjl.tools at gmail dot com
  2012-09-02 17:55 ` francesco.zappa.nardelli at gmail dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2012-09-02 17:05 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-09-02
                 CC|                            |rguenth at gcc dot gnu.org
   Target Milestone|---                         |4.8.0
            Summary|ICE get_loop_body, at       |[4.8 Regression] ICE
                   |cfgloop.c:830               |get_loop_body, at
                   |                            |cfgloop.c:830
     Ever Confirmed|0                           |1

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> 2012-09-02 17:05:24 UTC ---
It is caused by revision

http://gcc.gnu.org/ml/gcc-cvs/2012-03/msg01244.html


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

* [Bug tree-optimization/54458] [4.8 Regression] ICE get_loop_body, at cfgloop.c:830
  2012-09-02 15:38 [Bug tree-optimization/54458] New: get_loop_body, at cfgloop.c:830 francesco.zappa.nardelli at gmail dot com
                   ` (2 preceding siblings ...)
  2012-09-02 17:05 ` [Bug tree-optimization/54458] [4.8 Regression] " hjl.tools at gmail dot com
@ 2012-09-02 17:55 ` francesco.zappa.nardelli at gmail dot com
  2012-09-03  9:01 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: francesco.zappa.nardelli at gmail dot com @ 2012-09-02 17:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Francesco Zappa Nardelli <francesco.zappa.nardelli at gmail dot com> 2012-09-02 17:55:10 UTC ---
Just to be precise, the program has an undefined behaviour in the test of the
first 'if':

  (c ? 0 : 0 % 0)

because the right operand of % cannot be 0 (according to the standard,
§6.5.5#5).  Unclear to me if a compiler is allowed to crash on programs with
undefined behaviours or not.  

However an undefined-behaviour free (I believe) variant of that code makes gcc
crash similarly:

int g_24[][0];
int g_42;
int g_168[];

void func_34 (p_38) {
lbl_424:
  if (g_24[0][0] == 0 ? 1 : 1 % (g_24[0][0]))
    for (; g_42; g_42--)
lbl_130: {
    }
  else if (p_38)
    for (;;) {
    }
  if (g_168[0])
    goto lbl_130;
  goto lbl_424;
}

void main () {
  g_24[0][0] = 1;
  func_34(0);
}

$ gcc -O3 input.c   (gcc version 4.8.0 20120902 (experimental) (GCC) )

input-hand.c: In function 'func_34':
input-hand.c:5:6: internal compiler error: in get_loop_body, at cfgloop.c:823
 void func_34 (p_38) {
      ^
Please submit a full bug report.

Not sure that it helps, but while I was performing test-case reduction I
noticed that the % operator plays a key role in making gcc crash here.


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

* [Bug tree-optimization/54458] [4.8 Regression] ICE get_loop_body, at cfgloop.c:830
  2012-09-02 15:38 [Bug tree-optimization/54458] New: get_loop_body, at cfgloop.c:830 francesco.zappa.nardelli at gmail dot com
                   ` (3 preceding siblings ...)
  2012-09-02 17:55 ` francesco.zappa.nardelli at gmail dot com
@ 2012-09-03  9:01 ` rguenth at gcc dot gnu.org
  2012-09-03  9:06 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-03  9:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-03 09:00:53 UTC ---
I will have a look.


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

* [Bug tree-optimization/54458] [4.8 Regression] ICE get_loop_body, at cfgloop.c:830
  2012-09-02 15:38 [Bug tree-optimization/54458] New: get_loop_body, at cfgloop.c:830 francesco.zappa.nardelli at gmail dot com
                   ` (4 preceding siblings ...)
  2012-09-03  9:01 ` rguenth at gcc dot gnu.org
@ 2012-09-03  9:06 ` jakub at gcc dot gnu.org
  2012-09-03 14:27 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-09-03  9:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-09-03 09:06:29 UTC ---
Cleaned up testcase (and no longer invalid):
unsigned int a, b, c;

void
foo (unsigned int x)
{
  do
    {
      if (a == 0 ? 1 : 1 % a)
        for (; b; b--)
          lab:;
      else
        while (x)
          ;
      if (c)
        goto lab;
    }
  while (1);
}


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

* [Bug tree-optimization/54458] [4.8 Regression] ICE get_loop_body, at cfgloop.c:830
  2012-09-02 15:38 [Bug tree-optimization/54458] New: get_loop_body, at cfgloop.c:830 francesco.zappa.nardelli at gmail dot com
                   ` (5 preceding siblings ...)
  2012-09-03  9:06 ` jakub at gcc dot gnu.org
@ 2012-09-03 14:27 ` rguenth at gcc dot gnu.org
  2012-09-04  9:29 ` rguenth at gcc dot gnu.org
  2012-09-04 10:32 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-03 14:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-03 14:27:27 UTC ---
I'm testing

Index: gcc/tree-ssa-threadupdate.c
===================================================================
--- gcc/tree-ssa-threadupdate.c (revision 190889)
+++ gcc/tree-ssa-threadupdate.c (working copy)
@@ -1037,11 +1037,21 @@ thread_through_loop_header (struct loop
        }
       free (bblocks);

+      /* If the new header has multiple latches mark it so.  */
+      FOR_EACH_EDGE (e, ei, loop->header->preds)
+       if (e->src->loop_father == loop
+           && e->src != loop->latch)
+         {
+           loop->latch = NULL;
+           loops_state_set (LOOPS_MAY_HAVE_MULTIPLE_LATCHES);
+         }
+
       /* Cancel remaining threading requests that would make the
         loop a multiple entry loop.  */
       FOR_EACH_EDGE (e, ei, header->preds)


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

* [Bug tree-optimization/54458] [4.8 Regression] ICE get_loop_body, at cfgloop.c:830
  2012-09-02 15:38 [Bug tree-optimization/54458] New: get_loop_body, at cfgloop.c:830 francesco.zappa.nardelli at gmail dot com
                   ` (6 preceding siblings ...)
  2012-09-03 14:27 ` rguenth at gcc dot gnu.org
@ 2012-09-04  9:29 ` rguenth at gcc dot gnu.org
  2012-09-04 10:32 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-04  9:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-04 09:29:02 UTC ---
Author: rguenth
Date: Tue Sep  4 09:28:58 2012
New Revision: 190918

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190918
Log:
2012-09-04  Richard Guenther  <rguenther@suse.de>

    PR tree-optimization/54458
    * tree-ssa-threadupdate.c (thread_through_loop_header): If we
    turn the loop into one with multiple latches mark it so.

    * gcc.dg/torture/pr54458.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr54458.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-threadupdate.c


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

* [Bug tree-optimization/54458] [4.8 Regression] ICE get_loop_body, at cfgloop.c:830
  2012-09-02 15:38 [Bug tree-optimization/54458] New: get_loop_body, at cfgloop.c:830 francesco.zappa.nardelli at gmail dot com
                   ` (7 preceding siblings ...)
  2012-09-04  9:29 ` rguenth at gcc dot gnu.org
@ 2012-09-04 10:32 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-04 10:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #9 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-04 10:32:22 UTC ---
Fixed.


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

end of thread, other threads:[~2012-09-04 10:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-02 15:38 [Bug tree-optimization/54458] New: get_loop_body, at cfgloop.c:830 francesco.zappa.nardelli at gmail dot com
2012-09-02 15:42 ` [Bug tree-optimization/54458] ICE " francesco.zappa.nardelli at gmail dot com
2012-09-02 16:23 ` francesco.zappa.nardelli at gmail dot com
2012-09-02 17:05 ` [Bug tree-optimization/54458] [4.8 Regression] " hjl.tools at gmail dot com
2012-09-02 17:55 ` francesco.zappa.nardelli at gmail dot com
2012-09-03  9:01 ` rguenth at gcc dot gnu.org
2012-09-03  9:06 ` jakub at gcc dot gnu.org
2012-09-03 14:27 ` rguenth at gcc dot gnu.org
2012-09-04  9:29 ` rguenth at gcc dot gnu.org
2012-09-04 10:32 ` rguenth 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).