From 9fcebb5aa882861d403b87a572f17c69c8ecab08 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 6 Jun 2016 06:55:19 +0000 Subject: [PATCH] re PR tree-optimization/71398 (ICE at -O3 in 32-bit and 64-bit mode on x86_64-linux-gnu (Segmentation fault, find_edge)) 2016-06-06 Richard Biener PR tree-optimization/71398 * tree-ssa-loop-ivcanon.c (unloop_loops): First unloop, then remove edges. * gcc.dg/torture/pr71398.c: New testcase. From-SVN: r237117 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr71398.c | 17 +++++++++++++++++ gcc/tree-ssa-loop-ivcanon.c | 20 ++++++++++---------- 4 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr71398.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0b3e3aa81dd..8e4b77687f9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-06-06 Richard Biener + + PR tree-optimization/71398 + * tree-ssa-loop-ivcanon.c (unloop_loops): First unloop, then + remove edges. + 2016-06-05 James Bowman * config/ft32/ft32.c (ft32_setup_incoming_varargs, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c09354d3203..4dc8a52a75a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-06 Richard Biener + + PR tree-optimization/71398 + * gcc.dg/torture/pr71398.c: New testcase. + 2016-06-06 Uros Bizjak PR target/71389 diff --git a/gcc/testsuite/gcc.dg/torture/pr71398.c b/gcc/testsuite/gcc.dg/torture/pr71398.c new file mode 100644 index 00000000000..affb561d6cc --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr71398.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ + +unsigned a, b, c[1]; +void __assert_fail() __attribute__((__noreturn__)); +void fn1() +{ + int d; + unsigned e; + for (;;) + { + d = 0; + for (; d <= 6; d++) + c[d] || a ? 0 : __assert_fail(); + for (; e <= 5; e++) + a = b; + } +} diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c index 248c1259496..5a7c378a975 100644 --- a/gcc/tree-ssa-loop-ivcanon.c +++ b/gcc/tree-ssa-loop-ivcanon.c @@ -615,16 +615,6 @@ static void unloop_loops (bitmap loop_closed_ssa_invalidated, bool *irred_invalidated) { - /* First remove edges in peeled copies. */ - unsigned i; - edge e; - FOR_EACH_VEC_ELT (edges_to_remove, i, e) - { - bool ok = remove_path (e); - gcc_assert (ok); - } - edges_to_remove.release (); - while (loops_to_unloop.length ()) { struct loop *loop = loops_to_unloop.pop (); @@ -660,6 +650,16 @@ unloop_loops (bitmap loop_closed_ssa_invalidated, } loops_to_unloop.release (); loops_to_unloop_nunroll.release (); + + /* Remove edges in peeled copies. */ + unsigned i; + edge e; + FOR_EACH_VEC_ELT (edges_to_remove, i, e) + { + bool ok = remove_path (e); + gcc_assert (ok); + } + edges_to_remove.release (); } /* Tries to unroll LOOP completely, i.e. NITER times. -- 2.30.2