From: Richard Biener Date: Wed, 4 Apr 2018 07:52:20 +0000 (+0000) Subject: re PR tree-optimization/85168 (ICE in tree-ssa-coalesce.c: SSA corruption: Unable... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7d048870c1e97470af577e782c3285a827d6a49f;p=gcc.git re PR tree-optimization/85168 (ICE in tree-ssa-coalesce.c: SSA corruption: Unable to coalesce ssa_names which are marked as MUST COALESCE when -O2 is used) 2018-04-04 Richard Biener PR tree-optimization/85168 * tree-ssa-sccvn.c (vn_reference_maybe_forwprop_address): Avoid propagating abnormals. * gcc.dg/torture/pr85168.c: New testcase. From-SVN: r259068 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a861a189e3f..1370b34f466 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-04-04 Richard Biener + + PR tree-optimization/85168 + * tree-ssa-sccvn.c (vn_reference_maybe_forwprop_address): Avoid + propagating abnormals. + 2018-04-04 Chung-Ju Wu * config/nds32/nds32.md (enabled): Use yes/no for this attribute. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 95cd7c8392d..5c72bd78387 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-04-04 Richard Biener + + PR tree-optimization/85168 + * gcc.dg/torture/pr85168.c: New testcase. + 2018-04-04 Alexandre Oliva PR c++/84943 diff --git a/gcc/testsuite/gcc.dg/torture/pr85168.c b/gcc/testsuite/gcc.dg/torture/pr85168.c new file mode 100644 index 00000000000..cc5e6648c7e --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr85168.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target indirect_jumps } */ + +typedef struct { + struct { + char a; + } b; +} c; + +int d, f; +c *e; + +extern void i(void); +extern void sejtmp () __attribute__((returns_twice)); + +void g(void) +{ + c *h = e; + if (f) + { + i(); + h--; + if (d) + if (h->b.a) + i(); + } + if (h->b.a) + sejtmp(); + e = h; +} diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index fea452bd132..4e5f3385f9d 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -1249,7 +1249,9 @@ vn_reference_maybe_forwprop_address (vec *ops, return true; } if (!addr_base - || TREE_CODE (addr_base) != MEM_REF) + || TREE_CODE (addr_base) != MEM_REF + || (TREE_CODE (TREE_OPERAND (addr_base, 0)) == SSA_NAME + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (TREE_OPERAND (addr_base, 0)))) return false; off += addr_offset; @@ -1262,6 +1264,7 @@ vn_reference_maybe_forwprop_address (vec *ops, ptr = gimple_assign_rhs1 (def_stmt); ptroff = gimple_assign_rhs2 (def_stmt); if (TREE_CODE (ptr) != SSA_NAME + || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ptr) || TREE_CODE (ptroff) != INTEGER_CST) return false;