aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-05-12 10:54:29 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-05-12 10:54:29 +0000
commit53e788d00c62e4430ed77f65ad669b8c60e69420 (patch)
tree472a2bbcccd0aaf65c3b199dc33e708277edea3f
parent2ead1ab91123d2af20dac4dfa551355dacfef00d (diff)
downloadgcc-53e788d00c62e4430ed77f65ad669b8c60e69420.zip
gcc-53e788d00c62e4430ed77f65ad669b8c60e69420.tar.gz
gcc-53e788d00c62e4430ed77f65ad669b8c60e69420.tar.bz2
re PR tree-optimization/80713 (recent crash in update_dep_bb)
2017-05-12 Richard Biener <rguenther@suse.de> 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
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr80713.c24
-rw-r--r--gcc/tree-ssa-pre.c13
4 files changed, 48 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 580a3db..988e8c7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2017-05-12 Richard Biener <rguenther@suse.de>
+
+ 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 <thomas@codesourcery.com>
PR middle-end/69921
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7b73b92..b1c69d2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-05-12 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/80713
+ * gcc.dg/torture/pr80713.c: New testcase.
+
2017-05-12 Andi Kleen <ak@linux.intel.com>
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 0000000..18bd9b0
--- /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 38723df..c7062b7 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);
}