re PR tree-optimization/57122 (ICE in verify_loop_structure, at cfgloop.c:1647 (loop n’s latch does not have an edge to its header !))

2013-04-30  Richard Biener  <rguenther@suse.de>

	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
This commit is contained in:
Richard Biener 2013-04-30 15:03:58 +00:00 committed by Richard Biener
parent 4c1aff1ce4
commit 3551257c5d
4 changed files with 41 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2013-04-30 Richard Biener <rguenther@suse.de>
PR middle-end/57122
* cfghooks.c (split_edge): Properly check for the loop
latch edge.
2013-04-30 Richard Biener <rguenther@suse.de>
PR middle-end/57107

View File

@ -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;
}

View File

@ -1,3 +1,8 @@
2013-04-30 Richard Biener <rguenther@suse.de>
PR middle-end/57122
* gcc.dg/torture/pr57122.c: New testcase.
2013-04-30 Richard Biener <rguenther@suse.de>
PR middle-end/57107

View File

@ -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;
}