re PR rtl-optimization/17513 (ICE: verify_flow_info failed after gcse)
authorSteven Bosscher <stevenb@suse.de>
Fri, 17 Sep 2004 06:23:54 +0000 (06:23 +0000)
committerSteven Bosscher <steven@gcc.gnu.org>
Fri, 17 Sep 2004 06:23:54 +0000 (06:23 +0000)
        PR tree-optimization/17513
* cfgexpand.c (construct_init_block): Clear EDGE_EXECUTABLE
for successors of the entry block.

* gcc.dg/20040916-1.c: New test.

From-SVN: r87632

gcc/ChangeLog
gcc/cfgexpand.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/20040916-1.c [new file with mode: 0644]

index 9b79868280a7365f6c910b808a9a435363b538c9..21250cf2bf4529b10f09ec8158ce72faaba2d650 100644 (file)
@@ -1,3 +1,9 @@
+2004-09-17  Steven Bosscher  <stevenb@suse.de>
+
+        PR tree-optimization/17513
+       * cfgexpand.c (construct_init_block): Clear EDGE_EXECUTABLE
+       for successors of the entry block.
+
 2004-09-17  Uros Bizjak  <uros@kss-loka.si>
 
        PR rtl-optimization/15187
index 71dd039ca317ce13d4d9d4da05e0f02ebf92bb93..bf179fee0b637a0976f78252a3f9aba30a0fe190 100644 (file)
@@ -1082,11 +1082,21 @@ static basic_block
 construct_init_block (void)
 {
   basic_block init_block, first_block;
-  edge e;
+  edge e = NULL, e2;
+
+  for (e2 = ENTRY_BLOCK_PTR->succ; e2; e2 = e2->succ_next)
+    {
+      /* Clear EDGE_EXECUTABLE.  This flag is never used in the backend.
 
-  for (e = ENTRY_BLOCK_PTR->succ; e; e = e->succ_next)
-    if (e->dest == ENTRY_BLOCK_PTR->next_bb)
-      break;
+        For all other blocks this edge flag is cleared while expanding
+        a basic block in expand_gimple_basic_block, but there we never
+        looked at the successors of the entry block.
+        This caused PR17513.  */
+      e2->flags &= ~EDGE_EXECUTABLE;
+
+      if (e2->dest == ENTRY_BLOCK_PTR->next_bb)
+       e = e2;
+    }
 
   init_block = create_basic_block (NEXT_INSN (get_insns ()),
                                   get_last_insn (),
index 7a5fed34795c1fd6243e6576d1abdde51e9a3d23..85bc7ed985b18a6b73899953d8a7a49eb18719d8 100644 (file)
@@ -1,3 +1,8 @@
+2004-09-17  Steven Bosscher  <stevenb@suse.de>
+
+       PR tree-optimization/17513
+       * gcc.dg/20040916-1.c: New test.
+
 2004-09-16  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/17501
diff --git a/gcc/testsuite/gcc.dg/20040916-1.c b/gcc/testsuite/gcc.dg/20040916-1.c
new file mode 100644 (file)
index 0000000..fbea9e3
--- /dev/null
@@ -0,0 +1,45 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+/* PR17513 - we hit a bug where EDGE_EXECUTABLE was not cleared on
+   successors of the entry block.  This lead to a flow verification
+   error much later in the compilation (after gcse).  */
+typedef unsigned char uint8; 
+typedef unsigned int uint32; 
+uint32 marker = 0; 
+uint8 *buff = 0; 
+uint32 bsize = 0; 
+extern int foo (void); 
+uint32 
+bar (void) 
+{ 
+  int len, d; 
+  for (;;) 
+    { 
+      if (foo () == 0) 
+        return (0); 
+      switch (marker) 
+        { 
+        case 0xfe: 
+          { 
+            len |= (*buff++); 
+            bsize -= 2; 
+            while (len > 0) 
+              { 
+                d = *buff++; 
+                len--; 
+              } 
+          } 
+          break; 
+        default: 
+          break; 
+        } 
+    } 
+} 
+