This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[dwarf4 patch] Fix ICE in output_die when using -gdwarf-4 (part 2)
- From: Cary Coutant <ccoutant at google dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 7 Aug 2009 16:26:34 -0700
- Subject: [dwarf4 patch] Fix ICE in output_die when using -gdwarf-4 (part 2)
I'm checking in this patch to the dwarf4 branch. It fixes a second
condition that can cause an ICE in output_die. When copying "unworthy"
types into a type unit, if a DIE is inserted inside a context that had
earlier been copied, the new DIE never got walked to make sure the
types it referenced were also copied.
-cary
* dwarf2out.c (copy_ancestor_tree): Mark the new DIEs when
copying to a type unit.
(copy_decls_walk): Mark the new DIEs. Make sure newly-copied
DIEs are walked when inserted earlier into the tree.
Index: dwarf2out.c
===================================================================
--- dwarf2out.c (revision 150504)
+++ dwarf2out.c (working copy)
@@ -8643,6 +8643,10 @@ copy_ancestor_tree (dw_die_ref unit, dw_
copy = clone_as_declaration (die);
add_child_die (new_parent, copy);
+ /* Make sure the copy is marked as part of the type unit. */
+ if (decl_table != NULL)
+ copy->die_mark = 1;
+
if (slot != NULL)
{
/* Record in DECL_TABLE that DIE has been copied to UNIT. */
@@ -8652,7 +8656,6 @@ copy_ancestor_tree (dw_die_ref unit, dw_
*slot = entry;
}
-
return copy;
}
@@ -8694,6 +8697,10 @@ copy_decls_walk (dw_die_ref unit, dw_die
dw_die_ref parent = unit;
dw_die_ref copy = clone_tree (targ);
+ /* Make sure the cloned tree is marked as part of the
+ type unit. */
+ mark_dies (copy);
+
/* Record in DECL_TABLE that TARG has been copied.
Need to do this now, before the recursive call,
because DECL_TABLE may be expanded and SLOT
@@ -8713,6 +8720,12 @@ copy_decls_walk (dw_die_ref unit, dw_die
add_child_die (parent, copy);
a->dw_attr_val.v.val_die_ref.die = copy;
+
+ /* Make sure the newly-copied DIE is walked. If it was
+ installed in a previously-added context, it won't
+ get visited otherwise. */
+ if (parent != unit)
+ copy_decls_walk (unit, parent, decl_table);
}
}
}