* cfghooks.c (copy_bbs): Handle a null loop_father.
authorAldy Hernandez <aldyh@redhat.com>
Tue, 6 Nov 2012 23:55:29 +0000 (23:55 +0000)
committerRichard Henderson <rth@gcc.gnu.org>
Tue, 6 Nov 2012 23:55:29 +0000 (15:55 -0800)
From-SVN: r193270

gcc/ChangeLog
gcc/cfghooks.c

index 1cde0fa..e85aed0 100644 (file)
@@ -1,5 +1,7 @@
 2012-11-06  Aldy Hernandez  <aldyh@redhat.com>
 
+       * cfghooks.c (copy_bbs): Handle a null loop_father.
+
        * cgraph.c (cgraph_debug_gimple_stmt): Handle a null
        current_function_decl.
 
index d54dd46..39f2f93 100644 (file)
@@ -1258,12 +1258,15 @@ copy_bbs (basic_block *bbs, unsigned n, basic_block *new_bbs,
       new_bb = new_bbs[i] = duplicate_block (bb, NULL, after);
       after = new_bb;
       bb->flags |= BB_DUPLICATED;
-      /* Possibly set loop header.  */
-      if (bb->loop_father->header == bb && bb->loop_father != base)
-       new_bb->loop_father->header = new_bb;
-      /* Or latch.  */
-      if (bb->loop_father->latch == bb && bb->loop_father != base)
-       new_bb->loop_father->latch = new_bb;
+      if (bb->loop_father)
+       {
+         /* Possibly set loop header.  */
+         if (bb->loop_father->header == bb && bb->loop_father != base)
+           new_bb->loop_father->header = new_bb;
+         /* Or latch.  */
+         if (bb->loop_father->latch == bb && bb->loop_father != base)
+           new_bb->loop_father->latch = new_bb;
+       }
     }
 
   /* Set dominators.  */