aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgcleanup.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2017-04-18 11:31:30 -0600
committerJeff Law <law@gcc.gnu.org>2017-04-18 11:31:30 -0600
commitdd68669b66008ab4d8af324b1db3f187133e746b (patch)
tree797765178bd00aac43a514272bbfddb063251d55 /gcc/cfgcleanup.c
parent1cda61fc28d476c194db1c9f03676688d796ac4f (diff)
downloadgcc-dd68669b66008ab4d8af324b1db3f187133e746b.zip
gcc-dd68669b66008ab4d8af324b1db3f187133e746b.tar.gz
gcc-dd68669b66008ab4d8af324b1db3f187133e746b.tar.bz2
re PR middle-end/80422 (ICE on valid code at -O3 in 32-bit mode on x86_64-linux-gnu: in operator[], at vec.h:732)
PR middle-end/80422 * cfgcleanup.c (try_crossjump_to_edge): Verify SRC1 and SRC2 have predecessors after walking up the insn chain. PR middle-end/80422 * gcc.c-torture/compile/pr80422.c: New test. From-SVN: r246975
Diffstat (limited to 'gcc/cfgcleanup.c')
-rw-r--r--gcc/cfgcleanup.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index d55b0ce..f68a964 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -2017,6 +2017,11 @@ try_crossjump_to_edge (int mode, edge e1, edge e2,
if (newpos2 != NULL_RTX)
src2 = BLOCK_FOR_INSN (newpos2);
+ /* Check that SRC1 and SRC2 have preds again. They may have changed
+ above due to the call to flow_find_cross_jump. */
+ if (EDGE_COUNT (src1->preds) == 0 || EDGE_COUNT (src2->preds) == 0)
+ return false;
+
if (dir == dir_backward)
{
#define SWAP(T, X, Y) do { T tmp = (X); (X) = (Y); (Y) = tmp; } while (0)