* tree-ssa-ccp.c (optimize_unreachable): Check gsi_end_p
	before calling gsi_stmt.
From-SVN: r189539
+2012-07-16  Ulrich Weigand  <ulrich.weigand@linaro.org>
+
+       * tree-ssa-ccp.c (optimize_unreachable): Check gsi_end_p
+       before calling gsi_stmt.
+
 2012-07-16  Kirill Yukhin  <kirill.yukhin@intel.com>
 
        Revert
 
   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);