summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
authoruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>2012-07-16 14:27:53 +0000
committeruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>2012-07-16 14:27:53 +0000
commit522f73a10764fa17a12cc53c22b36ec1b935b2f6 (patch)
treea9b04d5699adbb5b09331d384183ac00cea3acf5 /gcc/tree-ssa-ccp.c
parenta204f0622242865ffea889bd698bc7c7bd236bd1 (diff)
downloadgcc-522f73a10764fa17a12cc53c22b36ec1b935b2f6.tar.gz
* 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
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r--gcc/tree-ssa-ccp.c6
1 files changed, 4 insertions, 2 deletions
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);