From 53e788d00c62e4430ed77f65ad669b8c60e69420 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 12 May 2017 10:54:29 +0000 Subject: [PATCH] re PR tree-optimization/80713 (recent crash in update_dep_bb) 2017-05-12 Richard Biener PR tree-optimization/80713 * tree-ssa-pre.c (remove_dead_inserted_code): Clear inserted_exprs bit for not removed stmts. * gcc.dg/torture/pr80713.c: New testcase. From-SVN: r247963 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr80713.c | 24 ++++++++++++++++++++++++ gcc/tree-ssa-pre.c | 13 +++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr80713.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 580a3db9853..988e8c795d4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-05-12 Richard Biener + + PR tree-optimization/80713 + * tree-ssa-pre.c (remove_dead_inserted_code): Clear + inserted_exprs bit for not removed stmts. + 2017-05-12 Thomas Schwinge PR middle-end/69921 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7b73b92759e..b1c69d29594 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-05-12 Richard Biener + + PR tree-optimization/80713 + * gcc.dg/torture/pr80713.c: New testcase. + 2017-05-12 Andi Kleen PR testsuite/77684 diff --git a/gcc/testsuite/gcc.dg/torture/pr80713.c b/gcc/testsuite/gcc.dg/torture/pr80713.c new file mode 100644 index 00000000000..18bd9b0e1e4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr80713.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ + +int a, b, d, e, f; +int *c; +void g() +{ + for (;;) + { + if (*c) { + int h; + *c = (__UINTPTR_TYPE__) &h; + } else + b = 0; + if (f) + *c = (__UINTPTR_TYPE__) g; + else + for (; a; a++) + for (;;) { + if (d) + break; + c = (int *) (__UINTPTR_TYPE__) e; + } + } +} diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 38723df733b..c7062b73798 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -4947,8 +4947,14 @@ remove_dead_inserted_code (void) } } + unsigned int to_clear = -1U; EXECUTE_IF_SET_IN_BITMAP (inserted_exprs, 0, i, bi) { + if (to_clear != -1U) + { + bitmap_clear_bit (inserted_exprs, to_clear); + to_clear = -1U; + } t = SSA_NAME_DEF_STMT (ssa_name (i)); if (!gimple_plf (t, NECESSARY)) { @@ -4969,7 +4975,14 @@ remove_dead_inserted_code (void) release_defs (t); } } + else + /* eliminate_fini will skip stmts marked for removal if we + already removed it and uses inserted_exprs for this, so + clear those we didn't end up removing. */ + to_clear = i; } + if (to_clear != -1U) + bitmap_clear_bit (inserted_exprs, to_clear); BITMAP_FREE (worklist); } -- 2.30.2