aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSegher Boessenkool <segher@kernel.crashing.org>2016-05-04 22:50:12 +0200
committerSegher Boessenkool <segher@gcc.gnu.org>2016-05-04 22:50:12 +0200
commit1a8fb012bda277aa1b4373d2f426986bce76460d (patch)
treeb365f615f8e40e96cefd511c4457912a5b7341e1
parent2d1ac15a6abfe3cf5cd6ee92a3d8960bd9fb1af8 (diff)
downloadgcc-1a8fb012bda277aa1b4373d2f426986bce76460d.zip
gcc-1a8fb012bda277aa1b4373d2f426986bce76460d.tar.gz
gcc-1a8fb012bda277aa1b4373d2f426986bce76460d.tar.bz2
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. From-SVN: r235903
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/cfgcleanup.c1
2 files changed, 6 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d174553..637aff5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
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;