From 0989c8530ce2fc6dc550ce789f2a601b4033e264 Mon Sep 17 00:00:00 2001 From: segher Date: Wed, 4 May 2016 20:50:12 +0000 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235903 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/cfgcleanup.c | 1 + 2 files changed, 6 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d17455318643..637aff5bfb1f 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 6e92d4cdde22..19583a78239f 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.47.3