cfgcleanup: Bugfix in try_simplify_condjump
authorSegher Boessenkool <segher@kernel.crashing.org>
Wed, 4 May 2016 20:50:12 +0000 (22:50 +0200)
committerSegher Boessenkool <segher@gcc.gnu.org>
Wed, 4 May 2016 20:50:12 +0000 (22:50 +0200)
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
gcc/cfgcleanup.c

index d1745531864390ecaecc86201309299675f71242..637aff5bfb1f4ec18f64a2b43081ea15b45b1dae 100644 (file)
@@ -1,3 +1,8 @@
+2016-05-04  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       * cfgcleanup.c (try_simplify_condjump): Don't try to simplify a
+       branch to a return.
+
 2016-05-04  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/70906
index 6e92d4cdde221265fa603a2621bef62e05e81ef5..19583a78239fc489cb62e9eecfdfeb4c6c596d56 100644 (file)
@@ -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;