diff options
author | Dodji Seketeli <dodji@redhat.com> | 2011-01-13 09:48:04 +0000 |
---|---|---|
committer | Dodji Seketeli <dodji@gcc.gnu.org> | 2011-01-13 10:48:04 +0100 |
commit | 71d12276670423b5a6bc35ba79feb481feed7c31 (patch) | |
tree | 6039297f3e55f62ba5f887b004cb69b057c680d3 | |
parent | 9b0f04e708f22d60c2093354798db28641e982a1 (diff) | |
download | gcc-71d12276670423b5a6bc35ba79feb481feed7c31.zip gcc-71d12276670423b5a6bc35ba79feb481feed7c31.tar.gz gcc-71d12276670423b5a6bc35ba79feb481feed7c31.tar.bz2 |
Fix PR debug/PR46973
gcc/
* dwarf2out.c (prune_unused_types_mark_generic_parms_dies): New
static function.
(prune_unused_types_mark): Use it.
gcc/testsuite/
* g++.dg/debug/dwarf2/template-params-9.C: New test.
From-SVN: r168743
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 31 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/debug/dwarf2/template-params-9.C | 28 |
4 files changed, 71 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b22f65e..2ae8613 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2011-01-13 Dodji Seketeli <dodji@redhat.com> + + PR debug/PR46973 + * dwarf2out.c (prune_unused_types_mark_generic_parms_dies): New + static function. + (prune_unused_types_mark): Use it. + 2011-01-13 Andrey Belevantsev <abel@ispras.ru> PR rtl-optimization/45352 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 7e64b37..ca17967 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -6477,6 +6477,7 @@ static void output_loc_list (dw_loc_list_ref); static char *gen_internal_sym (const char *); static void prune_unmark_dies (dw_die_ref); +static void prune_unused_types_mark_generic_parms_dies (dw_die_ref); static void prune_unused_types_mark (dw_die_ref, int); static void prune_unused_types_walk (dw_die_ref); static void prune_unused_types_walk_attribs (dw_die_ref); @@ -22245,6 +22246,32 @@ prune_unused_types_walk_attribs (dw_die_ref die) } } +/* Mark the generic parameters and arguments children DIEs of DIE. */ + +static void +prune_unused_types_mark_generic_parms_dies (dw_die_ref die) +{ + dw_die_ref c; + + if (die == NULL || die->die_child == NULL) + return; + c = die->die_child; + do + { + switch (c->die_tag) + { + case DW_TAG_template_type_param: + case DW_TAG_template_value_param: + case DW_TAG_GNU_template_template_param: + case DW_TAG_GNU_template_parameter_pack: + prune_unused_types_mark (c, 1); + break; + default: + break; + } + c = c->die_sib; + } while (c && c != die->die_child); +} /* Mark DIE as being used. If DOKIDS is true, then walk down to DIE's children. */ @@ -22258,6 +22285,10 @@ prune_unused_types_mark (dw_die_ref die, int dokids) { /* We haven't done this node yet. Mark it as used. */ die->die_mark = 1; + /* If this is the DIE of a generic type instantiation, + mark the children DIEs that describe its generic parms and + args. */ + prune_unused_types_mark_generic_parms_dies (die); /* We also have to mark its parents as used. (But we don't want to mark our parents' kids due to this.) */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0e0721c..f0b7c33 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-01-13 Dodji Seketeli <dodji@redhat.com> + + PR debug/PR46973 + * g++.dg/debug/dwarf2/template-params-9.C: New test. + 2011-01-13 Andrey Belevantsev <abel@ispras.ru> PR rtl-optimization/45352 diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/template-params-9.C b/gcc/testsuite/g++.dg/debug/dwarf2/template-params-9.C new file mode 100644 index 0000000..7af1d91 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/template-params-9.C @@ -0,0 +1,28 @@ +// Origin PR debug/PR46973 +// { dg-options "-g -dA" } +// { dg-do compile } + +struct S +{ + int f; +}; + +template<typename T, int I, int *P, int S::*MP> +struct Base +{ + template<typename Z> + struct Inner + { + }; +}; + +int a_global; + +int main () +{ + Base<long, 47, &a_global, &S::f>::Inner<float> inner; + return 0; +} + +// { dg-final { scan-assembler-times "DIE \\(\[^\n\r\]*\\) DW_TAG_template_type_param" 2 } } +// { dg-final { scan-assembler-times "DIE \\(\[^\n\r\]*\\) DW_TAG_template_value_param" 3 } } |