diff mbox

Fix PR50496

Message ID 20110926185409.GC1627@x4.trippels.de
State New
Headers show

Commit Message

Markus Trippelsdorf Sept. 26, 2011, 6:54 p.m. UTC
This patch from Chung-Lin Tang fixes PR50496.

I post it under his name (hope this is OK). The original patch can be
found here:
https://code.launchpad.net/~cltang/gcc-linaro/lp-748138-cfgrtl-fix-4_5/+merge/60742/+preview-diff/+files/preview.diff
https://bugs.launchpad.net/ubuntu/+source/gcc-4.5/+bug/748138

Bootstrapped and tested on x86_64-pc-linux-gnu.

2011-05-12  Chung-Lin Tang  <cltang@codesourcery.com>

	PR middle-end/50496
	* cfgrtl.c (try_redirect_by_replacing_jump): Treat EXIT_BLOCK_PTR case
	separately before call to redirect_jump(). Add assertion.
	(patch_jump_insn): Same.
diff mbox

Patch

diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index b3f045b..57f561f 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -846,11 +846,10 @@  try_redirect_by_replacing_jump (edge e, basic_block target, bool in_cfglayout)
       if (dump_file)
 	fprintf (dump_file, "Redirecting jump %i from %i to %i.\n",
 		 INSN_UID (insn), e->dest->index, target->index);
-      if (!redirect_jump (insn, block_label (target), 0))
-	{
-	  gcc_assert (target == EXIT_BLOCK_PTR);
-	  return NULL;
-	}
+      if (target == EXIT_BLOCK_PTR)
+	return NULL;
+      if (! redirect_jump (insn, block_label (target), 0))
+	gcc_unreachable ();
     }
 
   /* Cannot do anything for target exit block.  */
@@ -1030,11 +1029,10 @@  patch_jump_insn (rtx insn, rtx old_label, basic_block new_bb)
 	  /* If the substitution doesn't succeed, die.  This can happen
 	     if the back end emitted unrecognizable instructions or if
 	     target is exit block on some arches.  */
-	  if (!redirect_jump (insn, block_label (new_bb), 0))
-	    {
-	      gcc_assert (new_bb == EXIT_BLOCK_PTR);
-	      return false;
-	    }
+	  if (new_bb == EXIT_BLOCK_PTR)
+	    return false;
+	  if (! redirect_jump (insn, block_label (new_bb), 0))
+	    gcc_unreachable ();
 	}
     }
   return true;