+2012-12-20 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/55740
+ * cfghooks.c (merge_blocks): Properly handle merging of
+ two loop headers.
+
2012-12-20 Roland Stigge <stigge@debian.org>
Matthias Klose <doko@ubuntu.com>
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);
--- /dev/null
+// { 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;
+ }
+}