From: Richard Biener Date: Tue, 19 Sep 2017 11:57:39 +0000 (+0000) Subject: re PR tree-optimization/82244 (-O2: ICE: tree check: expected ssa_name, have integer_... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=109bb9107bc49ad4d396c387dd29fa9f6eeb9c39;p=gcc.git re PR tree-optimization/82244 (-O2: ICE: tree check: expected ssa_name, have integer_cst in replace_uses_by, at tree-cfg.c:1904) 2017-09-19 Richard Biener 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bc732f93a39..98806a35f59 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-09-19 Richard Biener + + 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 PR rtl-optimization/57878 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index aa6c7251f0d..a9e49e23bd8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-09-19 Richard Biener + + PR tree-optimization/82244 + * gcc.dg/torture/pr82244.c: New testcase. + 2017-09-19 Richard Biener 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 index 00000000000..3b385f97658 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr82244.c @@ -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(); + } + } + } + } +} diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 84cdd178bfa..221a07b6b3f 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -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);