From 3551257c5d24d5193edbdbc4604c1d995d50902b Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 30 Apr 2013 15:03:58 +0000 Subject: =?UTF-8?q?re=20PR=20tree-optimization/57122=20(ICE=20in=20verify?= =?UTF-8?q?=5Floop=5Fstructure,=20at=20cfgloop.c:1647=20(loop=20n=E2=80=99?= =?UTF-8?q?s=20latch=20does=20not=20have=20an=20edge=20to=20its=20header?= =?UTF-8?q?=20!))?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2013-04-30 Richard Biener PR middle-end/57122 * cfghooks.c (split_edge): Properly check for the loop latch edge. * gcc.dg/torture/pr57122.c: New testcase. From-SVN: r198456 --- gcc/ChangeLog | 6 ++++++ gcc/cfghooks.c | 4 +++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr57122.c | 27 +++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr57122.c (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bb86d6e..02b77f9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2013-04-30 Richard Biener + PR middle-end/57122 + * cfghooks.c (split_edge): Properly check for the loop + latch edge. + +2013-04-30 Richard Biener + PR middle-end/57107 * tree-eh.c (sink_clobbers): Preserve virtual SSA form. diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c index f583b2f..22b962b 100644 --- a/gcc/cfghooks.c +++ b/gcc/cfghooks.c @@ -662,7 +662,9 @@ split_edge (edge e) loop = find_common_loop (src->loop_father, dest->loop_father); add_bb_to_loop (ret, loop); - if (loop->latch == src) + /* If we split the latch edge of loop adjust the latch block. */ + if (loop->latch == src + && loop->header == dest) loop->latch = ret; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0d5705a..ae111b2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2013-04-30 Richard Biener + PR middle-end/57122 + * gcc.dg/torture/pr57122.c: New testcase. + +2013-04-30 Richard Biener + PR middle-end/57107 * g++.dg/torture/pr57107.C: New testcase. diff --git a/gcc/testsuite/gcc.dg/torture/pr57122.c b/gcc/testsuite/gcc.dg/torture/pr57122.c new file mode 100644 index 0000000..f1b99c8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr57122.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ + +unsigned a; +int b, c; + +void f(void) +{ + if(a) + { + for(a = 0; a < 2; a++) + a /= 7; + + for(;; a++) + { + if(a) + lbl1: + b++; + + if(c) + goto lbl1; +lbl2: + ; + } + } + + goto lbl2; +} -- cgit v1.1