From: Eric Botcazou Date: Tue, 18 Jan 2005 21:39:38 +0000 (+0100) Subject: re PR debug/16261 (ICE: output_die, at dwarf2out.c:6628) X-Git-Tag: releases/gcc-3.4.4~295 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ed83536abcb01d4960c12dc4841e12e25d78b45f;p=thirdparty%2Fgcc.git re PR debug/16261 (ICE: output_die, at dwarf2out.c:6628) PR debug/16261 Backport from mainline: 2004-01-27 Devang Patel * dwarf2out.c: (remove_child_TAG): New function. (gen_subprogram_die): Do not remove all children dies while reusing declaration die for definition. Instead, selectively remove only formal parameters. From-SVN: r93855 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b18fc1fece77..6eaafd01c7be 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2005-01-18 Eric Botcazou + + PR debug/16261 + Backport from mainline: + 2004-01-27 Devang Patel + + * dwarf2out.c: (remove_child_TAG): New function. + (gen_subprogram_die): Do not remove all children dies while reusing + declaration die for definition. Instead, selectively remove only + formal parameters. + 2005-01-18 Eric Botcazou PR rtl-optimization/19296 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 651d22909f99..9416023c5762 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -3649,6 +3649,7 @@ static bool is_java (void); static bool is_fortran (void); static bool is_ada (void); static void remove_AT (dw_die_ref, enum dwarf_attribute); +static void remove_child_TAG (dw_die_ref, enum dwarf_tag); static inline void free_die (dw_die_ref); static void remove_children (dw_die_ref); static void add_child_die (dw_die_ref, dw_die_ref); @@ -5055,6 +5056,34 @@ remove_AT (dw_die_ref die, enum dwarf_attribute attr_kind) } } +/* Remove child die whose die_tag is specified tag. */ + +static void +remove_child_TAG (dw_die_ref die, enum dwarf_tag tag) +{ + dw_die_ref current, prev, next; + current = die->die_child; + prev = NULL; + while (current != NULL) + { + if (current->die_tag == tag) + { + next = current->die_sib; + if (prev == NULL) + die->die_child = next; + else + prev->die_sib = next; + free_die (current); + current = next; + } + else + { + prev = current; + current = current->die_sib; + } + } +} + /* Free up the memory used by DIE. */ static inline void @@ -10872,9 +10901,9 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) { subr_die = old_die; - /* Clear out the declaration attribute and the parm types. */ + /* Clear out the declaration attribute and the formal parameters. */ remove_AT (subr_die, DW_AT_declaration); - remove_children (subr_die); + remove_child_TAG (subr_die, DW_TAG_formal_parameter); } else { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 45cc65f50467..9df14f7c95c0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2005-01-18 Eric Botcazou + + * g++.dg/debug/typedef3.C: New test. + 2005-01-18 Eric Botcazou * gcc.dg/short-compare-1.c: New test.