This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 1/3] cfgcleanup: Bugfix in try_simplify_condjump
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Segher Boessenkool <segher at kernel dot crashing dot org>
- Date: Tue, 3 May 2016 06:59:53 +0000
- Subject: [PATCH 1/3] cfgcleanup: Bugfix in try_simplify_condjump
- Authentication-results: sourceware.org; auth=none
- References: <cover dot 1462256244 dot git dot segher at kernel dot crashing dot org>
- References: <cover dot 1462256244 dot git dot segher at kernel dot crashing dot org>
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