From: Richard Biener Date: Thu, 20 Dec 2012 12:45:48 +0000 (+0000) Subject: re PR rtl-optimization/55740 (ICE in verify_loop_structure, at cfgloop.c:1582, error... X-Git-Tag: releases/gcc-4.8.0~1297 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=63f2ff0f23d633aad769997ec617ce2177c311ec;p=thirdparty%2Fgcc.git re PR rtl-optimization/55740 (ICE in verify_loop_structure, at cfgloop.c:1582, error: loop 2's header does not belong directly to it) 2012-12-20 Richard Biener PR middle-end/55740 * cfghooks.c (merge_blocks): Properly handle merging of two loop headers. * g++.dg/torture/pr55740.C: New testcase. From-SVN: r194633 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6d385605b629..01ed19b18258 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2012-12-20 Richard Biener + + PR middle-end/55740 + * cfghooks.c (merge_blocks): Properly handle merging of + two loop headers. + 2012-12-20 Roland Stigge Matthias Klose diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c index f09573160625..b729ae00504e 100644 --- a/gcc/cfghooks.c +++ b/gcc/cfghooks.c @@ -724,11 +724,23 @@ merge_blocks (basic_block a, basic_block b) cfg_hooks->merge_blocks (a, b); - /* If we merge a loop header into its predecessor, update the loop - structure. */ if (current_loops != NULL) { - if (b->loop_father->header == b) + /* If the block we merge into is a loop header do nothing unless ... */ + if (a->loop_father->header == a) + { + /* ... we merge two loop headers, in which case we kill + the inner loop. */ + if (b->loop_father->header == b) + { + b->loop_father->header = NULL; + b->loop_father->latch = NULL; + loops_state_set (LOOPS_NEED_FIXUP); + } + } + /* If we merge a loop header into its predecessor, update the loop + structure. */ + else if (b->loop_father->header == b) { remove_bb_from_loops (a); add_bb_to_loop (a, b->loop_father); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1b7c851df383..1f401cd7ac77 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-12-20 Richard Biener + + PR middle-end/55740 + * g++.dg/torture/pr55740.C: New testcase. + 2012-12-20 Jakub Jelinek PR c++/55619 diff --git a/gcc/testsuite/g++.dg/torture/pr55740.C b/gcc/testsuite/g++.dg/torture/pr55740.C new file mode 100644 index 000000000000..cdd84254399a --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr55740.C @@ -0,0 +1,19 @@ +// { dg-do compile } + +static bool st_IsPathDelimiter( char c ) { return c == '/'; } +bool IsValidPath( char const * filename ) +{ + if ( !filename || filename[0] == 0 ) + return false; + char const * run = filename; + while ( run && *run ) + { + if ( run[0] == '.' ) + if ( run[1] != '.' || ( !st_IsPathDelimiter( run[2] ) && run[2] != 0 ) ) + return false; + while ( *run && !st_IsPathDelimiter( *run ) ) + ++run; + if ( *run ) + ++run; + } +}