re PR tree-optimization/80842 (ICE at -O3 on x86_64-linux-gnu in "set_lattice_value")
authorRichard Biener <rguenther@suse.de>
Fri, 26 May 2017 07:19:00 +0000 (07:19 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 26 May 2017 07:19:00 +0000 (07:19 +0000)
2017-05-26  Richard Biener  <rguenther@suse.de>

PR tree-optimization/80842
* tree-ssa-ccp.c (set_lattice_value): Always meet with the old
value.

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

From-SVN: r248482

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

index 3505ba0576a6c01bef785eb6320310c417c6b2c5..f281611171a6dd8682cb31ebf0b120c545eb39d8 100644 (file)
@@ -1,3 +1,9 @@
+2017-05-26  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/80842
+       * tree-ssa-ccp.c (set_lattice_value): Always meet with the old
+       value.
+
 2017-05-26  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/80844
index 0adf5cb7b21e0d69942a1de14c48a79c1f9c138a..6042b1902eff7fa43db1caca89785ada093b1d26 100644 (file)
@@ -1,3 +1,8 @@
+2017-05-26  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/80842
+       * gcc.dg/torture/pr80842.c: New testcase.
+
 2017-05-25  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/79652
diff --git a/gcc/testsuite/gcc.dg/torture/pr80842.c b/gcc/testsuite/gcc.dg/torture/pr80842.c
new file mode 100644 (file)
index 0000000..600e8ce
--- /dev/null
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+
+unsigned a;
+short b;
+char c, d, e;
+void fn1();
+void fn2() {
+    a++;
+    for (; a;)
+      fn1(0, 0);
+}
+void fn3() {
+    fn2();
+l1:;
+   unsigned char f;
+   short g;
+   unsigned char *h = &f;
+   g += &h ? e ? g = 1 : 0 : 0;
+   d = g;
+   c *f;
+   if (d & (b %= *h) < f * d / (d -= 0))
+     goto l1;
+}
index b54062c9cea8387a41606feaf746dd627dc0f6c9..f18f2e0c2a4ca4b73ba9cdf3343eb374043eb4a3 100644 (file)
@@ -497,9 +497,7 @@ set_lattice_value (tree var, ccp_prop_value_t *new_val)
      use the meet operator to retain a conservative value.
      Missed optimizations like PR65851 makes this necessary.
      It also ensures we converge to a stable lattice solution.  */
-  if (new_val->lattice_val == CONSTANT
-      && old_val->lattice_val == CONSTANT
-      && TREE_CODE (new_val->value) != SSA_NAME)
+  if (old_val->lattice_val != UNINITIALIZED)
     ccp_lattice_meet (new_val, old_val);
 
   gcc_checking_assert (valid_lattice_transition (*old_val, *new_val));