This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 1/3] 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.


2016-05-03  Segher Boessenkool  <segher@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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]