This patch fixes http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54649

The previous patch is incorrect and will cause regression to
g++.dg/debug/dwarf2/deallocator.C

A new patch is attached. It solved the bootstrap problem for go.
Basically, when we set the line number for stmts in the finally block,
we don't want to change its block info.

The new patch can bootstrap, and passed gcc regression tests.

Is it okay for trunk?

Thanks,
Dehao

gcc/ChangeLog:
2012-09-20  Dehao Chen  <de...@google.com>

        PR go/54649
        * tree-eh.c (lower_try_finally_dup_block): Set the correct block for
        stmts in the duplicated EH block.

Index: gcc/tree-eh.c
===================================================================
--- gcc/tree-eh.c       (revision 191586)
+++ gcc/tree-eh.c       (working copy)
@@ -883,8 +883,15 @@ lower_try_finally_dup_block (gimple_seq seq, struc
   new_seq = copy_gimple_seq_and_replace_locals (seq);

   for (gsi = gsi_start (new_seq); !gsi_end_p (gsi); gsi_next (&gsi))
-    if (IS_UNKNOWN_LOCATION (gimple_location (gsi_stmt (gsi))))
-      gimple_set_location (gsi_stmt (gsi), loc);
+    {
+      gimple stmt = gsi_stmt (gsi);
+      if (IS_UNKNOWN_LOCATION (gimple_location (stmt)))
+       {
+         tree block = gimple_block (stmt);
+         gimple_set_location (stmt, loc);
+         gimple_set_block (stmt, block);
+       }
+    }

   if (outer_state->tf)
     region = outer_state->tf->try_finally_expr;

Reply via email to