If the jump_block here contains just a return, we will crash later
in invert_jump.  Don't allow that case.


2016-05-03  Segher Boessenkool  <seg...@kernel.crashing.org>

        * cfgcleanup.c (try_simplify_condjump): Don't try to simplify a
        branch to a return.

---
 gcc/cfgcleanup.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index 6e92d4c..19583a7 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;
 
-- 
1.9.3

Reply via email to