summaryrefslogtreecommitdiff
path: root/gcc/cfgcleanup.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2017-04-18 17:31:30 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2017-04-18 17:31:30 +0000
commit804569465688c6f4c9acdccfb070f39e0105560f (patch)
tree797765178bd00aac43a514272bbfddb063251d55 /gcc/cfgcleanup.c
parent4ec1a73857bfc8adad5104bb9970209d99be4dc3 (diff)
downloadgcc-804569465688c6f4c9acdccfb070f39e0105560f.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246975 138bc75d-0d04-0410-961f-82ee72b054a4
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 d55b0ceb832..f68a964e31e 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)