aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2014-04-23 08:23:33 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2014-04-23 08:23:33 +0000
commit92562f8869378b0fd06de4e1d695d89d8a6ca0b4 (patch)
tree4f579ba7e74e212e39b147abfa15da53ff0f3181 /gcc
parent1c33c9b70c60fc4c520cb55aa239ffb48ab88f9a (diff)
downloadgcc-92562f8869378b0fd06de4e1d695d89d8a6ca0b4.zip
gcc-92562f8869378b0fd06de4e1d695d89d8a6ca0b4.tar.gz
gcc-92562f8869378b0fd06de4e1d695d89d8a6ca0b4.tar.bz2
re PR tree-optimization/60891 (ICE: SIGSEGV (Invalid write/read) in pre_and_rev_post_order_compute_fn with -O -fno-tree-ch -fno-tree-cselim -fno-tree-dominator-opts)
2014-04-23 Richard Biener <rguenther@suse.de> PR middle-end/60891 * loop-init.c (loop_optimizer_init): Make sure to apply LOOPS_MAY_HAVE_MULTIPLE_LATCHES before fixing up loops. * gcc.dg/torture/pr60891.c: New testcase. From-SVN: r209673
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/loop-init.c17
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr60891.c23
4 files changed, 44 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1098089..bac9f35 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-04-23 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/60891
+ * loop-init.c (loop_optimizer_init): Make sure to apply
+ LOOPS_MAY_HAVE_MULTIPLE_LATCHES before fixing up loops.
+
2014-04-22 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/60275
diff --git a/gcc/loop-init.c b/gcc/loop-init.c
index 90453f6..59f52d0 100644
--- a/gcc/loop-init.c
+++ b/gcc/loop-init.c
@@ -94,20 +94,15 @@ loop_optimizer_init (unsigned flags)
else
{
bool recorded_exits = loops_state_satisfies_p (LOOPS_HAVE_RECORDED_EXITS);
+ bool needs_fixup = loops_state_satisfies_p (LOOPS_NEED_FIXUP);
gcc_assert (cfun->curr_properties & PROP_loops);
/* Ensure that the dominators are computed, like flow_loops_find does. */
calculate_dominance_info (CDI_DOMINATORS);
- if (loops_state_satisfies_p (LOOPS_NEED_FIXUP))
- {
- loops_state_clear (~0U);
- fix_loop_structure (NULL);
- }
-
#ifdef ENABLE_CHECKING
- else
+ if (!needs_fixup)
verify_loop_structure ();
#endif
@@ -115,6 +110,14 @@ loop_optimizer_init (unsigned flags)
if (recorded_exits)
release_recorded_exits ();
loops_state_clear (~0U);
+
+ if (needs_fixup)
+ {
+ /* Apply LOOPS_MAY_HAVE_MULTIPLE_LATCHES early as fix_loop_structure
+ re-applies flags. */
+ loops_state_set (flags & LOOPS_MAY_HAVE_MULTIPLE_LATCHES);
+ fix_loop_structure (NULL);
+ }
}
/* Apply flags to loops. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index abbd1cf..8f1bfc6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-04-23 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/60891
+ * gcc.dg/torture/pr60891.c: New testcase.
+
2014-04-22 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/60275
diff --git a/gcc/testsuite/gcc.dg/torture/pr60891.c b/gcc/testsuite/gcc.dg/torture/pr60891.c
new file mode 100644
index 0000000..c8fec87
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr60891.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fno-tree-ch -fno-tree-cselim -fno-tree-dominator-opts" } */
+
+int a, b, c, d, e, f;
+
+void foo (int x)
+{
+ for (;;)
+ {
+ int g = c;
+ if (x)
+ {
+ if (e)
+ while (a)
+ --f;
+ }
+ for (b = 5; b; b--)
+ {
+ }
+ if (!g)
+ x = 0;
+ }
+}