re PR tree-optimization/87117 (ICE in eliminate_dom_walker::eliminate_cleanup(bool...
authorRichard Biener <rguenther@suse.de>
Tue, 28 Aug 2018 10:14:45 +0000 (10:14 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 28 Aug 2018 10:14:45 +0000 (10:14 +0000)
2018-08-28  Richard Biener  <rguenther@suse.de>

PR tree-optimization/87117
* tree-ssa-sccvn.c (fully_constant_vn_reference_p): Exclude
void which is is_gimple_reg_type by checking for COMPLETE_TYPE_P.

* gcc.dg/pr87117-1.c: New testcase.

From-SVN: r263911

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr87117-1.c [new file with mode: 0644]
gcc/tree-ssa-sccvn.c

index dd3ca99c80efc395870a135a60a791a7fdc78a6f..694fdf24db3f2b656ba4109827fd0678d13b0a1d 100644 (file)
@@ -1,3 +1,9 @@
+2018-08-28  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/87117
+       * tree-ssa-sccvn.c (fully_constant_vn_reference_p): Exclude
+       void which is is_gimple_reg_type by checking for COMPLETE_TYPE_P.
+
 2018-08-28  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/87117
index aa6f7707333afbbc8b4652180f074eb37dd7fb7f..bf4f5f7c5c94382913113bb5de1532d519e654e5 100644 (file)
@@ -1,3 +1,8 @@
+2018-08-28  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/87117
+       * gcc.dg/pr87117-1.c: New testcase.
+
 2018-08-28  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/87117
diff --git a/gcc/testsuite/gcc.dg/pr87117-1.c b/gcc/testsuite/gcc.dg/pr87117-1.c
new file mode 100644 (file)
index 0000000..06d7008
--- /dev/null
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-inline -fno-tree-dce" } */
+
+int a, b, c;
+long *d;
+void fn1()
+{
+  for (; 0 < a;)
+    a++;
+}
+void fn3()
+{
+  for (; c; c++)
+    d[c] = 0;
+}
+void fn2()
+{
+  if (b)
+    fn3();
+  fn1();
+}
index 42676487c86bfdf0d5e41089b224651fcad1754c..381fc8dc1958bd750be73a6862bcf1ebaf321be9 100644 (file)
@@ -1408,6 +1408,7 @@ fully_constant_vn_reference_p (vn_reference_t ref)
 
   /* Simplify reads from constants or constant initializers.  */
   else if (BITS_PER_UNIT == 8
+          && COMPLETE_TYPE_P (ref->type)
           && is_gimple_reg_type (ref->type)
           && (!INTEGRAL_TYPE_P (ref->type)
               || TYPE_PRECISION (ref->type) % BITS_PER_UNIT == 0))