This patch, originally from Chung-Lin Tang, fixes PR50496. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50496
Can someone please review and commit it? Thanks. Bootstrapped and tested on x86_64-pc-linux-gnu. 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 --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; -- Markus