This patch disables removing of
DW_AT_{declaration,object_pointer,formal_parameter} tags while
generating a DIE for subprograms. Now that we generate dwarf info
early, we will always have an old_die the second time around. I see no
need to remove the aforementioned tags, only to create them again
(incorrectly in a C++ testcase I have).
Previously I had the removal predicated by !old_die->dumped_early, hence
removing it only if it had not been dumped early, but this is
problematic since types do not have the `dumped_early' flag set. I
could add a debug_hook for early_type_decl(), as we did for
early_global_decl(), so we can tag dumped early types as such, but I'm
_hoping_ the change here is sufficient. Things should "just work". If
not, perhaps we can look into adding an early_type_decl() hook or some
other solution.
With this patch I am finally able to build all of libstdc++ without any
ICEs, all while keeping the guality.exp tests for C at less regressions
than mainline.
Comitting to branch. Whine if in violent disagreement.
Aldy
commit 8face8fdb00474fe3e2375d08eab52726e125b8a
Author: Aldy Hernandez <al...@redhat.com>
Date: Thu Sep 18 12:37:43 2014 -0600
* dwarf2out.c (gen_subprogram_die): Disable removal of
DW_AT_{declaration,object_pointer,formal_parameter}.
(remove_child_TAG): Mark as ATTRIBUTE_UNUSED temporarily.
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 0ad8b5d..f6c7f4a 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -4771,7 +4771,7 @@ move_all_children (dw_die_ref old_parent, dw_die_ref
new_parent)
/* Remove child DIE whose die_tag is TAG. Do nothing if no child
matches TAG. */
-static void
+static void ATTRIBUTE_UNUSED
remove_child_TAG (dw_die_ref die, enum dwarf_tag tag)
{
dw_die_ref c;
@@ -18301,17 +18301,16 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
/* ??? Hmmm, early dwarf generation happened earlier, so no
sense in removing the parameters. Let's keep them and
augment them with location information later. */
- if (!old_die->dumped_early)
- {
- /* Clear out the declaration attribute and the formal parameters.
- Do not remove all children, because it is possible that this
- declaration die was forced using force_decl_die(). In such
- cases die that forced declaration die (e.g.
TAG_imported_module)
- is one of the children that we do not want to remove. */
- remove_AT (subr_die, DW_AT_declaration);
- remove_AT (subr_die, DW_AT_object_pointer);
- remove_child_TAG (subr_die, DW_TAG_formal_parameter);
- }
+#if 0
+ /* Clear out the declaration attribute and the formal parameters.
+ Do not remove all children, because it is possible that this
+ declaration die was forced using force_decl_die(). In such
+ cases die that forced declaration die (e.g. TAG_imported_module)
+ is one of the children that we do not want to remove. */
+ remove_AT (subr_die, DW_AT_declaration);
+ remove_AT (subr_die, DW_AT_object_pointer);
+ remove_child_TAG (subr_die, DW_TAG_formal_parameter);
+#endif
}
else
{