public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/56035] New: ICE in verify_loop_structure, at cfgloop.c:1581 (loop n’s header does not belong directly to it !)
@ 2013-01-18 17:28 antoine.balestrat at gmail dot com
  2013-01-18 17:34 ` [Bug tree-optimization/56035] [4.8 Regression] " mpolacek at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: antoine.balestrat at gmail dot com @ 2013-01-18 17:28 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56035
           Summary: ICE in verify_loop_structure, at cfgloop.c:1581 (loop
                    n’s header does not belong directly to it !)
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: antoine.balestrat@gmail.com


Hi !
Using GCC 4.8.0 as of 20130118 :

$ cat bb.c
short a, c, *p;

void f(void)
{
    int b;

    if(c)
lbl1:
        for(a = 0; a < 1; a++)
        {
            for(c = 0; c < 1; c++)
            {
                goto lbl1;
                while (*p++)
lbl2:
                    ;
            }
        }

    for(;; b++)
    {
        if(c)
            goto lbl2;
lbl3:
        for(c = 0; c < 9; c++)
            for(c = -17; c < 2; c++)
                if(*p)
                    goto lbl3;
    }
}

$ xgcc -w -O1 -ftree-vectorize -fcse-follow-jumps -fstrict-overflow bb.c
bb.c: In function ‘f’:
bb.c:30:1: error: size of loop 4 should be 0, not 2
 }
 ^
bb.c:30:1: error: bb 6 do not belong to loop 4
bb.c:30:1: error: bb 5 do not belong to loop 4
bb.c:30:1: error: bb 6 has father loop 1, should be loop 4
bb.c:30:1: error: bb 5 has father loop 1, should be loop 4
bb.c:30:1: error: loop 4’s header does not belong directly to it
bb.c:30:1: internal compiler error: in verify_loop_structure, at cfgloop.c:1581
0x5f8788 verify_loop_structure()
    ../../srcdir/gcc/cfgloop.c:1581
0xcb7b2e cleanup_cfg(int)
    ../../srcdir/gcc/cfgcleanup.c:3026
0xcdf29e rest_of_handle_cse
    ../../srcdir/gcc/cse.c:7443
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


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

* [Bug tree-optimization/56035] [4.8 Regression] ICE in verify_loop_structure, at cfgloop.c:1581 (loop n’s header does not belong directly to it !)
  2013-01-18 17:28 [Bug tree-optimization/56035] New: ICE in verify_loop_structure, at cfgloop.c:1581 (loop n’s header does not belong directly to it !) antoine.balestrat at gmail dot com
@ 2013-01-18 17:34 ` mpolacek at gcc dot gnu.org
  2013-01-18 21:59 ` mpolacek at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-01-18 17:34 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-01-18
                 CC|                            |mpolacek at gcc dot gnu.org
      Known to work|                            |4.7.3
            Summary|ICE in                      |[4.8 Regression] ICE in
                   |verify_loop_structure, at   |verify_loop_structure, at
                   |cfgloop.c:1581 (loop n’s    |cfgloop.c:1581 (loop n’s
                   |header does not belong      |header does not belong
                   |directly to it !)           |directly to it !)
     Ever Confirmed|0                           |1
      Known to fail|                            |4.8.0

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> 2013-01-18 17:33:47 UTC ---
Confirmed.


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

* [Bug tree-optimization/56035] [4.8 Regression] ICE in verify_loop_structure, at cfgloop.c:1581 (loop n’s header does not belong directly to it !)
  2013-01-18 17:28 [Bug tree-optimization/56035] New: ICE in verify_loop_structure, at cfgloop.c:1581 (loop n’s header does not belong directly to it !) antoine.balestrat at gmail dot com
  2013-01-18 17:34 ` [Bug tree-optimization/56035] [4.8 Regression] " mpolacek at gcc dot gnu.org
@ 2013-01-18 21:59 ` mpolacek at gcc dot gnu.org
  2013-01-18 23:25 ` mpolacek at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-01-18 21:59 UTC (permalink / raw)
  To: gcc-bugs


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

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

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> 2013-01-18 21:59:14 UTC ---
Started with http://gcc.gnu.org/viewcvs?view=revision&revision=194582


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

* [Bug tree-optimization/56035] [4.8 Regression] ICE in verify_loop_structure, at cfgloop.c:1581 (loop n’s header does not belong directly to it !)
  2013-01-18 17:28 [Bug tree-optimization/56035] New: ICE in verify_loop_structure, at cfgloop.c:1581 (loop n’s header does not belong directly to it !) antoine.balestrat at gmail dot com
  2013-01-18 17:34 ` [Bug tree-optimization/56035] [4.8 Regression] " mpolacek at gcc dot gnu.org
  2013-01-18 21:59 ` mpolacek at gcc dot gnu.org
@ 2013-01-18 23:25 ` mpolacek at gcc dot gnu.org
  2013-01-21 13:27 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-01-18 23:25 UTC (permalink / raw)
  To: gcc-bugs


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

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

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> 2013-01-18 23:25:19 UTC ---
Mine for now.


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

* [Bug tree-optimization/56035] [4.8 Regression] ICE in verify_loop_structure, at cfgloop.c:1581 (loop n’s header does not belong directly to it !)
  2013-01-18 17:28 [Bug tree-optimization/56035] New: ICE in verify_loop_structure, at cfgloop.c:1581 (loop n’s header does not belong directly to it !) antoine.balestrat at gmail dot com
                   ` (2 preceding siblings ...)
  2013-01-18 23:25 ` mpolacek at gcc dot gnu.org
@ 2013-01-21 13:27 ` rguenth at gcc dot gnu.org
  2013-01-22 10:22 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-01-21 13:27 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-checking
           Priority|P3                          |P1
   Target Milestone|---                         |4.8.0


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

* [Bug tree-optimization/56035] [4.8 Regression] ICE in verify_loop_structure, at cfgloop.c:1581 (loop n’s header does not belong directly to it !)
  2013-01-18 17:28 [Bug tree-optimization/56035] New: ICE in verify_loop_structure, at cfgloop.c:1581 (loop n’s header does not belong directly to it !) antoine.balestrat at gmail dot com
                   ` (3 preceding siblings ...)
  2013-01-21 13:27 ` rguenth at gcc dot gnu.org
@ 2013-01-22 10:22 ` mpolacek at gcc dot gnu.org
  2013-01-22 11:39 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-01-22 10:22 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> 2013-01-22 10:22:21 UTC ---
The problem looks to be in fix_loop_structures:
      /* If there was no latch, schedule the loop for removal.  */
      if (!first_latch)
        loop->header = NULL;
      /* If there was a single latch and it belongs to the loop of the
         header, record it.  */
      else if (latch
               && latch->src->loop_father == loop)
        loop->latch = latch->src;
      /* Otherwise there are multiple latches which are eventually
         disambiguated below.  */
      else 
        loop->latch = NULL;
we have the first_latch and there's only one latch edge, so we should the the
else if branch.  But we don't, since latch->src->loop_father != loop.  It looks
like the loop_father info isn't correct at all, ->loop_father->num is always 0,
but if we defer re-computing the latches to after re-scanning the bodies of
loops and fixing the nesting, everything seems to be fine (and the final
assembly is the same as before r194582).

The CFG is quite weird though, e.g. EXIT has no predecessors at all.


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

* [Bug tree-optimization/56035] [4.8 Regression] ICE in verify_loop_structure, at cfgloop.c:1581 (loop n’s header does not belong directly to it !)
  2013-01-18 17:28 [Bug tree-optimization/56035] New: ICE in verify_loop_structure, at cfgloop.c:1581 (loop n’s header does not belong directly to it !) antoine.balestrat at gmail dot com
                   ` (4 preceding siblings ...)
  2013-01-22 10:22 ` mpolacek at gcc dot gnu.org
@ 2013-01-22 11:39 ` jakub at gcc dot gnu.org
  2013-01-22 13:25 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-01-22 11:39 UTC (permalink / raw)
  To: gcc-bugs


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

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

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-22 11:38:47 UTC ---
EXIT with no predecessors is fine, if the body of the function always ends with
endless loops.  Consider void foo (void) { for (;;); } which doesn't have any
EXIT predecessors either.


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

* [Bug tree-optimization/56035] [4.8 Regression] ICE in verify_loop_structure, at cfgloop.c:1581 (loop n’s header does not belong directly to it !)
  2013-01-18 17:28 [Bug tree-optimization/56035] New: ICE in verify_loop_structure, at cfgloop.c:1581 (loop n’s header does not belong directly to it !) antoine.balestrat at gmail dot com
                   ` (5 preceding siblings ...)
  2013-01-22 11:39 ` jakub at gcc dot gnu.org
@ 2013-01-22 13:25 ` mpolacek at gcc dot gnu.org
  2013-01-25  8:52 ` mpolacek at gcc dot gnu.org
  2013-01-25  8:53 ` mpolacek at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-01-22 13:25 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> 2013-01-22 13:24:40 UTC ---
Created attachment 29248
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29248
pr56035

Potential fix


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

* [Bug tree-optimization/56035] [4.8 Regression] ICE in verify_loop_structure, at cfgloop.c:1581 (loop n’s header does not belong directly to it !)
  2013-01-18 17:28 [Bug tree-optimization/56035] New: ICE in verify_loop_structure, at cfgloop.c:1581 (loop n’s header does not belong directly to it !) antoine.balestrat at gmail dot com
                   ` (6 preceding siblings ...)
  2013-01-22 13:25 ` mpolacek at gcc dot gnu.org
@ 2013-01-25  8:52 ` mpolacek at gcc dot gnu.org
  2013-01-25  8:53 ` mpolacek at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-01-25  8:52 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> 2013-01-25 08:52:33 UTC ---
Author: mpolacek
Date: Fri Jan 25 08:52:02 2013
New Revision: 195462

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

Added:
    trunk/gcc/testsuite/gcc.dg/pr56035.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cfgloopmanip.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug tree-optimization/56035] [4.8 Regression] ICE in verify_loop_structure, at cfgloop.c:1581 (loop n’s header does not belong directly to it !)
  2013-01-18 17:28 [Bug tree-optimization/56035] New: ICE in verify_loop_structure, at cfgloop.c:1581 (loop n’s header does not belong directly to it !) antoine.balestrat at gmail dot com
                   ` (7 preceding siblings ...)
  2013-01-25  8:52 ` mpolacek at gcc dot gnu.org
@ 2013-01-25  8:53 ` mpolacek at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-01-25  8:53 UTC (permalink / raw)
  To: gcc-bugs


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

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

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

--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> 2013-01-25 08:53:16 UTC ---
Fixed.


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

end of thread, other threads:[~2013-01-25  8:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-18 17:28 [Bug tree-optimization/56035] New: ICE in verify_loop_structure, at cfgloop.c:1581 (loop n’s header does not belong directly to it !) antoine.balestrat at gmail dot com
2013-01-18 17:34 ` [Bug tree-optimization/56035] [4.8 Regression] " mpolacek at gcc dot gnu.org
2013-01-18 21:59 ` mpolacek at gcc dot gnu.org
2013-01-18 23:25 ` mpolacek at gcc dot gnu.org
2013-01-21 13:27 ` rguenth at gcc dot gnu.org
2013-01-22 10:22 ` mpolacek at gcc dot gnu.org
2013-01-22 11:39 ` jakub at gcc dot gnu.org
2013-01-22 13:25 ` mpolacek at gcc dot gnu.org
2013-01-25  8:52 ` mpolacek at gcc dot gnu.org
2013-01-25  8:53 ` mpolacek 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).