re PR tree-optimization/82244 (-O2: ICE: tree check: expected ssa_name, have integer_...
authorRichard Biener <rguenther@suse.de>
Tue, 19 Sep 2017 11:57:39 +0000 (11:57 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 19 Sep 2017 11:57:39 +0000 (11:57 +0000)
2017-09-19  Richard Biener  <rguenther@suse.de>

PR tree-optimization/82244
* tree-vrp.c (remove_range_assertions): Do not propagate
a constant to abnormals but replace the assert with a copy.

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

From-SVN: r252973

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

index bc732f9..98806a3 100644 (file)
@@ -1,3 +1,9 @@
+2017-09-19  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/82244
+       * tree-vrp.c (remove_range_assertions): Do not propagate
+       a constant to abnormals but replace the assert with a copy.
+
 2017-09-19  Alexander Monakov  <amonakov@ispras.ru>
 
        PR rtl-optimization/57878
index aa6c725..a9e49e2 100644 (file)
@@ -1,5 +1,10 @@
 2017-09-19  Richard Biener  <rguenther@suse.de>
 
+       PR tree-optimization/82244
+       * gcc.dg/torture/pr82244.c: New testcase.
+
+2017-09-19  Richard Biener  <rguenther@suse.de>
+
        PR tree-optimization/69728
        * gfortran.dg/graphite/pr69728.f90: New testcase.
        * gcc.dg/graphite/pr69728.c: Likewise.
diff --git a/gcc/testsuite/gcc.dg/torture/pr82244.c b/gcc/testsuite/gcc.dg/torture/pr82244.c
new file mode 100644 (file)
index 0000000..3b385f9
--- /dev/null
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+
+typedef struct a {
+  struct a *b;
+} a;
+
+extern int d(void);
+extern int g(void);
+extern int h(void);
+extern int _setjmp(void *);
+
+int c(void)
+{
+  1 ? d() : 0;
+
+  a *e;
+  while (e) {
+      e = (e == (a *) c) ? 0 : e->b;
+      while (e) {
+         int f = 0;
+         g();
+         if (_setjmp(0)) {
+             if (f & 6) {
+                 ;
+             } else if (f & 2) {
+                 h();
+             }
+         }
+      }
+  }
+}
index 84cdd17..221a07b 100644 (file)
@@ -7039,6 +7039,14 @@ remove_range_assertions (void)
                  FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
                    SET_USE (use_p, var);
              }
+           /* But do not propagate constants as that is invalid.  */
+           else if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs))
+             {
+               gassign *ass = gimple_build_assign (lhs, var);
+               gsi_replace (&si, ass, true);
+               gsi_next (&si);
+               continue;
+             }
            else
              replace_uses_by (lhs, var);