re PR tree-optimization/46216 (ICE: SSA corruption)
authorRichard Guenther <rguenther@suse.de>
Tue, 2 Nov 2010 16:58:40 +0000 (16:58 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 2 Nov 2010 16:58:40 +0000 (16:58 +0000)
2010-11-02  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/46216
* tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars):
Check if we can propagate from a POINTER_PLUS_EXPR before doing so.

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

From-SVN: r166203

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr46216.c [new file with mode: 0644]
gcc/tree-ssa-forwprop.c

index 05337716498833c5dd5da4f5f9a68ac864359534..4a2611a3806227c5f9c2119febd9bfcf41b5b95e 100644 (file)
@@ -1,3 +1,9 @@
+2010-11-02  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/46216
+       * tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars):
+       Check if we can propagate from a POINTER_PLUS_EXPR before doing so.
+
 2010-11-02  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * configure.ac (*-*-irix6*): Disable set_have_as_tls.
index 44a575c2896098bccd18ff74a88685e43f287e1e..32fedf6b43cd4572dbc91ae6e364a08cb03fa6c1 100644 (file)
@@ -1,3 +1,8 @@
+2010-11-02  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/46216
+       * gcc.dg/torture/pr46216.c: New testcase.
+
 2010-11-02  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        PR target/46131
diff --git a/gcc/testsuite/gcc.dg/torture/pr46216.c b/gcc/testsuite/gcc.dg/torture/pr46216.c
new file mode 100644 (file)
index 0000000..b257dbf
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+
+typedef int Embryo_Cell;
+int
+embryo_program_run(Embryo_Cell *cip)
+{
+    unsigned char op;
+    Embryo_Cell offs;
+    static const void *switchtable[256] = {
+       &&SWITCHTABLE_EMBRYO_OP_NONE, &&SWITCHTABLE_EMBRYO_OP_LOAD_PRI
+    };
+    for (;;)
+      {
+       op = *cip++;
+       while (1) {
+           goto *switchtable[op];
+SWITCHTABLE_EMBRYO_OP_LOAD_PRI:
+           offs = *(Embryo_Cell *)cip++;
+SWITCHTABLE_EMBRYO_OP_NONE:
+           break;
+       };
+      }
+    return offs;
+}
index f4808e78fffbb9786ed6f8d763b8a428aa17b6cd..a8284083067bb8ce45584a7592dbb035b2f0962e 100644 (file)
@@ -1983,7 +1983,8 @@ tree_ssa_forward_propagate_single_use_vars (void)
                  else
                    gsi_next (&gsi);
                }
-             else if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
+             else if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR
+                      && can_propagate_from (stmt))
                {
                  if (TREE_CODE (gimple_assign_rhs2 (stmt)) == INTEGER_CST
                      /* ???  Better adjust the interface to that function