re PR tree-optimization/79186 (ICE on valid code at -O2 and -O3 on x86_64-linux-gnu...
authorRichard Biener <rguenther@suse.de>
Mon, 23 Jan 2017 13:08:44 +0000 (13:08 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 23 Jan 2017 13:08:44 +0000 (13:08 +0000)
2017-01-23  Richard Biener  <rguenther@suse.de>

PR tree-optimization/79186
* tree-vrp.c (register_new_assert_for): Make sure we've seen
both incoming edges before moving an assert.

* gcc.dg/torture/pr79186.c: New testcase.
* gcc.dg/torture/pr79187.c: Likewise.

From-SVN: r244804

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr79186.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/pr79187.c [new file with mode: 0644]
gcc/tree-vrp.c

index 3ade7c76e279688853250df6bbca798ec145bc2d..71aaad9bcc482f6b4f7bbcf1d15ef220c1e4ddd3 100644 (file)
@@ -1,3 +1,9 @@
+2017-01-23  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/79186
+       * tree-vrp.c (register_new_assert_for): Make sure we've seen
+       both incoming edges before moving an assert.
+
 2017-01-23  Martin Jambor  <mjambor@suse.cz>
 
        * ipa-prop.c (load_from_param_1): Removed.
index d53090552ac2a18452c6f4328be5b241cc2b57b2..c64baf573e3469306bf9b5ae261fa654e2a6f7f5 100644 (file)
@@ -1,3 +1,9 @@
+2017-01-23  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/79186
+       * gcc.dg/torture/pr79186.c: New testcase.
+       * gcc.dg/torture/pr79187.c: Likewise.
+
 2017-01-23  Martin Jambor  <mjambor@suse.cz>
 
        * gcc.dg/ipa/vrp8.c: New test.
diff --git a/gcc/testsuite/gcc.dg/torture/pr79186.c b/gcc/testsuite/gcc.dg/torture/pr79186.c
new file mode 100644 (file)
index 0000000..cefbe39
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+
+int a, b;
+unsigned char c, d, e;
+
+int main ()
+{ 
+  if (b || !a)
+    { 
+      c = a;
+      if (!c && !a)
+       d = 0;
+      e = -a;
+    }
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr79187.c b/gcc/testsuite/gcc.dg/torture/pr79187.c
new file mode 100644 (file)
index 0000000..b310a02
--- /dev/null
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+
+int printf (const char *, ...);
+
+int a, b = -600, c, d[] = { 0 }, e, f, g = -1, h;
+unsigned i = ~0;
+
+int main ()
+{
+  for (; h < 2; h++)
+    {
+      if (a > 0)
+       printf ("%d\n", d[b]);
+      f = ~(b % i);
+      c = g | (f && g) && e | b;
+      a = ~(~g & b);
+    }
+  return 0; 
+}
index ac37d3f6e149a3562c5585f63ceb28c14657638c..d7d7a0d3a08c3d1930b38c81d113b3881180e20e 100644 (file)
@@ -5035,6 +5035,7 @@ register_new_assert_for (tree name, tree expr,
          /* If we have the same assertion on all incoming edges of a BB
             instead insert it at the beginning of it.  */
          if (e && loc->e
+             && e != loc->e
              && dest_bb == loc->e->dest
              && EDGE_COUNT (dest_bb->preds) == 2)
            {