]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/61385 (ICE on valid code at -O2 and -O3 on x86_64-linux-gnu)
authorMarc Glisse <marc.glisse@inria.fr>
Wed, 4 Jun 2014 18:38:18 +0000 (20:38 +0200)
committerMarc Glisse <glisse@gcc.gnu.org>
Wed, 4 Jun 2014 18:38:18 +0000 (18:38 +0000)
2014-06-04  Marc Glisse  <marc.glisse@inria.fr>

PR tree-optimization/61385
gcc/
* tree-ssa-phiopt.c (value_replacement): Punt if there are PHI nodes.
gcc/testsuite/
* gcc.dg/tree-ssa/pr61385.c: New file.

From-SVN: r211245

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/pr61385.c [new file with mode: 0644]
gcc/tree-ssa-phiopt.c

index 7486ec072d692c9d50984a2470fca67299aa5110..ca574c002ef3bd2806346b798c275ddaf3b3fed1 100644 (file)
@@ -1,3 +1,8 @@
+2014-06-04  Marc Glisse  <marc.glisse@inria.fr>
+
+       PR tree-optimization/61385
+       * tree-ssa-phiopt.c (value_replacement): Punt if there are PHI nodes.
+
 2014-06-04  Bernd Schmidt  <bernds@codesourcery.com>
 
        * lto-wrapper.c (fatal, fatal_perror): Remove functions.  All callers
index 883a2bd43b2f40095400f87239d57075d999f913..e53501c7e78b1888a87dfae113b1af5291aacabc 100644 (file)
@@ -1,3 +1,8 @@
+2014-06-04  Marc Glisse  <marc.glisse@inria.fr>
+
+       PR tree-optimization/61385
+       * gcc.dg/tree-ssa/pr61385.c: New file.
+
 2014-06-04  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/60098
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr61385.c b/gcc/testsuite/gcc.dg/tree-ssa/pr61385.c
new file mode 100644 (file)
index 0000000..f2e5a3c
--- /dev/null
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#define assert(x) if (!(x)) __builtin_abort ()
+
+int a, b, c, d, e, f, g;
+
+int
+fn1 ()
+{
+  int *h = &c;
+  for (; c < 1; c++)
+    {
+      int *i = &a, *k = &a;
+      f = 0;
+      if (b)
+       return 0;
+      if (*h)
+       {
+         int **j = &i;
+         *j = 0;
+         d = 0;
+       }
+      else
+       g = e = 0;
+      if (*h)
+       {
+         int **l = &k;
+         *l = &g;
+       }
+      d &= *h;
+      assert (k == &a || k);
+      assert (i);
+    }
+  return 0;
+}
+
+int
+main ()
+{
+  fn1 (); 
+  return 0;
+}
index e3b6f1dd6a37c777255accac193f01a6deb1a759..95844f461859633524c1fa88e0af1580db7c4800 100644 (file)
@@ -849,6 +849,10 @@ value_replacement (basic_block cond_bb, basic_block middle_bb,
          && !POINTER_TYPE_P (TREE_TYPE (arg0))))
     return 0;
 
+  /* Punt if there are (degenerate) PHIs in middle_bb, there should not be.  */
+  if (!gimple_seq_empty_p (phi_nodes (middle_bb)))
+    return 0;
+
   /* Only transform if it removes the condition.  */
   if (!single_non_singleton_phi_for_edges (phi_nodes (gimple_bb (phi)), e0, e1))
     return 0;