public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/51069] New: ICE in verify_loop_structure, at cfgloop.c:1559
@ 2011-11-09 20:59 regehr at cs dot utah.edu
  2011-11-10 11:18 ` [Bug rtl-optimization/51069] [4.7 Regression] " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: regehr at cs dot utah.edu @ 2011-11-09 20:59 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51069
           Summary: ICE in verify_loop_structure, at cfgloop.c:1559
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: regehr@cs.utah.edu
                CC: chenyang@cs.utah.edu


[regehr@gamow tmp056]$ current-gcc -v

Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/uusoc/exports/scratch/regehr/z/compiler-install/gcc-r181229-install/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --with-libelf=/usr/local --enable-lto
--prefix=/home/regehr/z/compiler-install/gcc-r181229-install
--program-prefix=r181229- --enable-languages=c,c++
Thread model: posix
gcc version 4.7.0 20111109 (experimental) (GCC) 

[regehr@gamow tmp056]$ current-gcc -Ofast -funroll-loops -c -w small.c

small.c: In function 'func_44':
small.c:73:1: error: edge from 10 to 12 should be marked irreducible
small.c:73:1: error: basic block 12 should be marked irreducible
small.c:73:1: internal compiler error: in verify_loop_structure, at
cfgloop.c:1559
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

[regehr@gamow tmp056]$ cat small.c


int
func_27 (int left, int right)
{
  return left;
}

int
func_29 (int left, int right)
{
  return left;
}

struct S0
{
  int f0;
  int f3;
};
struct S1
{
  struct S0 f4;
  int f8;
};
struct S0 g_107;
int g_132;
struct S0 g_147;
int g_154;
struct S1 g_288;
struct S1 g_399;
int func_52 (int, struct S0);
int func_55 ();
int
func_44 (int p_46, int p_47)
{
  struct S0 l_170;
  int l_356[] = {
    0
  };
lbl_598:if (p_46)
    {
    }
  else
    {
    lbl_485:func_52 (0, l_170);
      if (func_29 (func_27 (g_399.f8, 0), 0))
    for (g_107.f0 = 0; g_107.f0 >= 0; g_107.f0 -= 1)
      {
        for (;;)
          if (l_356[1])
        break;
        if (g_288.f4.f3)
          goto lbl_485;
        if (g_399.f8)
          {
        g_132 = 0;
        continue;
          }
        for (; g_154; g_154 = 0)
          {
          }
      }
    }
  if (func_55 ())
    {
    }
  else
    for (g_147.f0 = 0;;)
      {
    if (p_46)
      continue;
    goto lbl_598;
      }
  return 0;
}


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

* [Bug rtl-optimization/51069] [4.7 Regression] ICE in verify_loop_structure, at cfgloop.c:1559
  2011-11-09 20:59 [Bug c/51069] New: ICE in verify_loop_structure, at cfgloop.c:1559 regehr at cs dot utah.edu
@ 2011-11-10 11:18 ` rguenth at gcc dot gnu.org
  2011-12-05  9:48 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-11-10 11:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-*-*
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-11-10
          Component|c                           |rtl-optimization
      Known to work|                            |4.6.2
   Target Milestone|---                         |4.7.0
            Summary|ICE in                      |[4.7 Regression] ICE in
                   |verify_loop_structure, at   |verify_loop_structure, at
                   |cfgloop.c:1559              |cfgloop.c:1559
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-11-10 11:10:27 UTC ---
Confirmed.  Caused by RTL unrolling.


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

* [Bug rtl-optimization/51069] [4.7 Regression] ICE in verify_loop_structure, at cfgloop.c:1559
  2011-11-09 20:59 [Bug c/51069] New: ICE in verify_loop_structure, at cfgloop.c:1559 regehr at cs dot utah.edu
  2011-11-10 11:18 ` [Bug rtl-optimization/51069] [4.7 Regression] " rguenth at gcc dot gnu.org
@ 2011-12-05  9:48 ` jakub at gcc dot gnu.org
  2011-12-05 12:46 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-12-05  9:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-12-05 09:47:33 UTC ---
Started with http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171946
Tiny bit reduced testcase for -O3 -funroll-loops:
int a, b, c, d, e, f, bar (void);

void
foo (int x)
{
  for (;;)
    {
      if (!x)
        {
          for (d = 6; d >= 0; d--)
            {
              while (!b)
                ;
              if (e)
                return foo (x);
              if (f)
                {
                  a = 0;
                  continue;
                }
              for (; c; c--)
                ;
            }
        }
      if (bar ())
        break;
      e = 0;
      if (x)
        for (;;)
          ;
    }
}


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

* [Bug rtl-optimization/51069] [4.7 Regression] ICE in verify_loop_structure, at cfgloop.c:1559
  2011-11-09 20:59 [Bug c/51069] New: ICE in verify_loop_structure, at cfgloop.c:1559 regehr at cs dot utah.edu
  2011-11-10 11:18 ` [Bug rtl-optimization/51069] [4.7 Regression] " rguenth at gcc dot gnu.org
  2011-12-05  9:48 ` jakub at gcc dot gnu.org
@ 2011-12-05 12:46 ` jakub at gcc dot gnu.org
  2011-12-06 13:56 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-12-05 12:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-12-05 12:46:05 UTC ---
CCing Honza, not familiar enough with remove_path/unroll.
#0  unloop (loop=0x7ffff133d880, irred_invalidated=0x7fffffffdeef "") at
../../gcc/cfgloopmanip.c:797
#1  0x0000000000675e53 in remove_path (e=0x7ffff146c900) at
../../gcc/cfgloopmanip.c:319
#2  0x00000000009ae07f in peel_loop_completely (loop=0x7ffff133d880) at
../../gcc/loop-unroll.c:514
#3  0x00000000009ad89f in peel_loops_completely (flags=2) at
../../gcc/loop-unroll.c:256
#4  0x00000000009ad640 in unroll_and_peel_loops (flags=2) at
../../gcc/loop-unroll.c:165
#5  0x00000000009a07e4 in rtl_unroll_and_peel_loops () at
../../gcc/loop-init.c:329

is called with
loop_2 (header = 6, latch = 21, niter = )
{
  bb_6 (preds = {bb_21 bb_45 }, succs = {bb_9 bb_7 })
  bb_9 (preds = {bb_6 }, succs = {bb_10 bb_11 })
  bb_11 (preds = {bb_9 }, succs = {bb_21 bb_12 })
  bb_21 (preds = {bb_11 }, succs = {bb_6 })
}
where bb_4, bb_12, bb_13 and bb_14 are BB_IRREDUCIBLE_LOOP, before this unroll
call verify_loop_structure passes, after it already fails.  Of course calling
mark_irreducible_loops () after peel_loops_completely () fixes this up and let
the testcase pass, but remove_path/unroll should figure it out if it
invalidates this property.


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

* [Bug rtl-optimization/51069] [4.7 Regression] ICE in verify_loop_structure, at cfgloop.c:1559
  2011-11-09 20:59 [Bug c/51069] New: ICE in verify_loop_structure, at cfgloop.c:1559 regehr at cs dot utah.edu
                   ` (2 preceding siblings ...)
  2011-12-05 12:46 ` jakub at gcc dot gnu.org
@ 2011-12-06 13:56 ` rguenth at gcc dot gnu.org
  2011-12-23 21:47 ` hubicka at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-12-06 13:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-checking
           Priority|P3                          |P1


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

* [Bug rtl-optimization/51069] [4.7 Regression] ICE in verify_loop_structure, at cfgloop.c:1559
  2011-11-09 20:59 [Bug c/51069] New: ICE in verify_loop_structure, at cfgloop.c:1559 regehr at cs dot utah.edu
                   ` (3 preceding siblings ...)
  2011-12-06 13:56 ` rguenth at gcc dot gnu.org
@ 2011-12-23 21:47 ` hubicka at gcc dot gnu.org
  2011-12-27 18:50 ` hubicka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hubicka at gcc dot gnu.org @ 2011-12-23 21:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Jan Hubicka <hubicka at gcc dot gnu.org> 2011-12-23 19:15:21 UTC ---
I am not terribly familiar with the logic here either, Zdenek?


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

* [Bug rtl-optimization/51069] [4.7 Regression] ICE in verify_loop_structure, at cfgloop.c:1559
  2011-11-09 20:59 [Bug c/51069] New: ICE in verify_loop_structure, at cfgloop.c:1559 regehr at cs dot utah.edu
                   ` (4 preceding siblings ...)
  2011-12-23 21:47 ` hubicka at gcc dot gnu.org
@ 2011-12-27 18:50 ` hubicka at gcc dot gnu.org
  2011-12-27 19:05 ` hubicka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hubicka at gcc dot gnu.org @ 2011-12-27 18:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jan Hubicka <hubicka at gcc dot gnu.org> 2011-12-27 18:32:05 UTC ---
note that remove_path may affect presence of irreducible loops and it already
has logic to update the flags.  It seems to be case that gets missed.  I am
trying to make sense of it now.


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

* [Bug rtl-optimization/51069] [4.7 Regression] ICE in verify_loop_structure, at cfgloop.c:1559
  2011-11-09 20:59 [Bug c/51069] New: ICE in verify_loop_structure, at cfgloop.c:1559 regehr at cs dot utah.edu
                   ` (5 preceding siblings ...)
  2011-12-27 18:50 ` hubicka at gcc dot gnu.org
@ 2011-12-27 19:05 ` hubicka at gcc dot gnu.org
  2012-01-01 12:08 ` hubicka at gcc dot gnu.org
  2012-01-01 15:03 ` hubicka at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: hubicka at gcc dot gnu.org @ 2011-12-27 19:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jan Hubicka <hubicka at gcc dot gnu.org> 2011-12-27 18:50:14 UTC ---
OK,
the problem is that by removing conditional entrance into irreducible region,
the BB becomes part of the region itself.
I am testing the following patch
Index: cfgloopmanip.c
===================================================================
--- cfgloopmanip.c      (revision 182692)
+++ cfgloopmanip.c      (working copy)
@@ -290,6 +290,7 @@ remove_path (edge e)
   int i, nrem, n_bord_bbs;
   sbitmap seen;
   bool irred_invalidated = false;
+  edge_iterator ei;

   if (!can_remove_branch_p (e))
     return false;
@@ -329,9 +330,12 @@ remove_path (edge e)
   /* Find "border" hexes -- i.e. those with predecessor in removed path.  */
   for (i = 0; i < nrem; i++)
     SET_BIT (seen, rem_bbs[i]->index);
+  FOR_EACH_EDGE (ae, ei, e->src->succs)
+    if (ae != e && ae->dest != EXIT_BLOCK_PTR && !TEST_BIT (seen,
ae->dest->index)
+       && ae->flags & EDGE_IRREDUCIBLE_LOOP)
+      irred_invalidated = true;
   for (i = 0; i < nrem; i++)
     {
-      edge_iterator ei;
       bb = rem_bbs[i];
       FOR_EACH_EDGE (ae, ei, rem_bbs[i]->succs)
        if (ae->dest != EXIT_BLOCK_PTR && !TEST_BIT (seen, ae->dest->index))


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

* [Bug rtl-optimization/51069] [4.7 Regression] ICE in verify_loop_structure, at cfgloop.c:1559
  2011-11-09 20:59 [Bug c/51069] New: ICE in verify_loop_structure, at cfgloop.c:1559 regehr at cs dot utah.edu
                   ` (6 preceding siblings ...)
  2011-12-27 19:05 ` hubicka at gcc dot gnu.org
@ 2012-01-01 12:08 ` hubicka at gcc dot gnu.org
  2012-01-01 15:03 ` hubicka at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: hubicka at gcc dot gnu.org @ 2012-01-01 12:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jan Hubicka <hubicka at gcc dot gnu.org> 2012-01-01 12:07:42 UTC ---
Author: hubicka
Date: Sun Jan  1 12:07:34 2012
New Revision: 182767

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182767
Log:
    PR rtl-optimization/51069
    * cfgloopmanip.c (remove_path): Removing path making irreducible
    region unconditional makes BB part of the region.
    * gcc.c-torture/compile/pr51069.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr51069.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cfgloopmanip.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug rtl-optimization/51069] [4.7 Regression] ICE in verify_loop_structure, at cfgloop.c:1559
  2011-11-09 20:59 [Bug c/51069] New: ICE in verify_loop_structure, at cfgloop.c:1559 regehr at cs dot utah.edu
                   ` (7 preceding siblings ...)
  2012-01-01 12:08 ` hubicka at gcc dot gnu.org
@ 2012-01-01 15:03 ` hubicka at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: hubicka at gcc dot gnu.org @ 2012-01-01 15:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #8 from Jan Hubicka <hubicka at gcc dot gnu.org> 2012-01-01 15:01:57 UTC ---
Fixed.


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

end of thread, other threads:[~2012-01-01 15:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-09 20:59 [Bug c/51069] New: ICE in verify_loop_structure, at cfgloop.c:1559 regehr at cs dot utah.edu
2011-11-10 11:18 ` [Bug rtl-optimization/51069] [4.7 Regression] " rguenth at gcc dot gnu.org
2011-12-05  9:48 ` jakub at gcc dot gnu.org
2011-12-05 12:46 ` jakub at gcc dot gnu.org
2011-12-06 13:56 ` rguenth at gcc dot gnu.org
2011-12-23 21:47 ` hubicka at gcc dot gnu.org
2011-12-27 18:50 ` hubicka at gcc dot gnu.org
2011-12-27 19:05 ` hubicka at gcc dot gnu.org
2012-01-01 12:08 ` hubicka at gcc dot gnu.org
2012-01-01 15:03 ` hubicka 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).