tree-ssa-ccp.c (optimize_unreachable): Check gsi_end_p before calling gsi_stmt.
authorUlrich Weigand <ulrich.weigand@linaro.org>
Mon, 16 Jul 2012 14:27:53 +0000 (14:27 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Mon, 16 Jul 2012 14:27:53 +0000 (14:27 +0000)
* tree-ssa-ccp.c (optimize_unreachable): Check gsi_end_p
before calling gsi_stmt.

From-SVN: r189539

gcc/ChangeLog
gcc/tree-ssa-ccp.c

index b85d46003185b69c40e765b8c860604ac2145f22..6bf3edcec4c4e08fc4f64ce9134e5d17fae6f071 100644 (file)
@@ -1,3 +1,8 @@
+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
index d2ce870a1f00af273b048ac2f0ed7de9563061de..6dc30e148cd1c8f9b7beb20f97156f6b9422009d 100644 (file)
@@ -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);