From 522f73a10764fa17a12cc53c22b36ec1b935b2f6 Mon Sep 17 00:00:00 2001 From: uweigand Date: Mon, 16 Jul 2012 14:27:53 +0000 Subject: * tree-ssa-ccp.c (optimize_unreachable): Check gsi_end_p before calling gsi_stmt. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@189539 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-ccp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gcc/tree-ssa-ccp.c') diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index d2ce870a1f0..6dc30e148cd 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -2355,9 +2355,11 @@ optimize_unreachable (gimple_stmt_iterator i) FOR_EACH_EDGE (e, ei, bb->preds) { gsi = gsi_last_bb (e->src); - stmt = gsi_stmt (gsi); + if (gsi_end_p (gsi)) + continue; - if (stmt && gimple_code (stmt) == GIMPLE_COND) + stmt = gsi_stmt (gsi); + if (gimple_code (stmt) == GIMPLE_COND) { if (e->flags & EDGE_TRUE_VALUE) gimple_cond_make_false (stmt); -- cgit v1.2.1