From 1a8fb012bda277aa1b4373d2f426986bce76460d Mon Sep 17 00:00:00 2001 From: Segher Boessenkool Date: Wed, 4 May 2016 22:50:12 +0200 Subject: [PATCH] cfgcleanup: Bugfix in try_simplify_condjump If the jump_block here contains just a return, we will crash later in invert_jump. Don't allow that case. * cfgcleanup.c (try_simplify_condjump): Don't try to simplify a branch to a return. From-SVN: r235903 --- gcc/ChangeLog | 5 +++++ gcc/cfgcleanup.c | 1 + 2 files changed, 6 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d1745531864..637aff5bfb1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-05-04 Segher Boessenkool + + * cfgcleanup.c (try_simplify_condjump): Don't try to simplify a + branch to a return. + 2016-05-04 Jakub Jelinek PR c++/70906 diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index 6e92d4cdde2..19583a78239 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -156,6 +156,7 @@ try_simplify_condjump (basic_block cbranch_block) cbranch_dest_block = cbranch_jump_edge->dest; if (cbranch_dest_block == EXIT_BLOCK_PTR_FOR_FN (cfun) + || jump_dest_block == EXIT_BLOCK_PTR_FOR_FN (cfun) || !can_fallthru (jump_block, cbranch_dest_block)) return false; -- 2.30.2