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 bc732f93a3923afd2fc4cca940b07a7f5beaad8f..98806a35f5993c892d08c3a6baf08b7f7830e8bb 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 aa6c7251f0d01b55a1f6adbbdfd185b428a1d8bf..a9e49e23bd815df4f0f7c0f00bafa8bcf28fa579 100644 (file)
@@ -1,3 +1,8 @@
+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
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 84cdd178bfaf5d841bcb1218154f6d08f4f25e3b..221a07b6b3fc6ae3cc737d4fc0c811d614e9a705 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);