aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-01-31 11:33:57 -0500
committerJason Merrill <jason@gcc.gnu.org>2013-01-31 11:33:57 -0500
commit90b10decd8e668eacfce1b1ed8c31453702acbfb (patch)
tree60fbb865dbcf70d674dfd0bc60afe3acd942d75f
parent6e61611091c9446c62eb88c2257d5f43ad396fc2 (diff)
downloadgcc-90b10decd8e668eacfce1b1ed8c31453702acbfb.zip
gcc-90b10decd8e668eacfce1b1ed8c31453702acbfb.tar.gz
gcc-90b10decd8e668eacfce1b1ed8c31453702acbfb.tar.bz2
re PR debug/54410 (doubled DW_TAG_template_type_param)
PR c++/54410 * dwarf2out.c (gen_struct_or_union_type_die): Always schedule template parameters the first time. (gen_scheduled_generic_parms_dies): Check completeness here. From-SVN: r195613
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/dwarf2out.c12
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/template-params-11.C9
3 files changed, 22 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a8d2d64..880dff8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2013-01-31 Jason Merrill <jason@redhat.com>
+
+ PR c++/54410
+ * dwarf2out.c (gen_struct_or_union_type_die): Always schedule template
+ parameters the first time.
+ (gen_scheduled_generic_parms_dies): Check completeness here.
+
2013-01-31 Richard Biener <rguenther@suse.de>
PR middle-end/53073
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 5a03280..3106dd9 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -19061,6 +19061,10 @@ gen_struct_or_union_type_die (tree type, dw_die_ref context_die,
scope_die = scope_die_for (type, context_die);
+ /* Generate child dies for template paramaters. */
+ if (!type_die && debug_info_level > DINFO_LEVEL_TERSE)
+ schedule_generic_params_dies_gen (type);
+
if (! type_die || (nested && is_cu_die (scope_die)))
/* First occurrence of type or toplevel definition of nested class. */
{
@@ -19078,11 +19082,6 @@ gen_struct_or_union_type_die (tree type, dw_die_ref context_die,
else
remove_AT (type_die, DW_AT_declaration);
- /* Generate child dies for template paramaters. */
- if (debug_info_level > DINFO_LEVEL_TERSE
- && COMPLETE_TYPE_P (type))
- schedule_generic_params_dies_gen (type);
-
/* If this type has been completed, then give it a byte_size attribute and
then give a list of members. */
if (complete && !ns_decl)
@@ -20592,7 +20591,8 @@ gen_scheduled_generic_parms_dies (void)
return;
FOR_EACH_VEC_ELT (*generic_type_instances, i, t)
- gen_generic_params_dies (t);
+ if (COMPLETE_TYPE_P (t))
+ gen_generic_params_dies (t);
}
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/template-params-11.C b/gcc/testsuite/g++.dg/debug/dwarf2/template-params-11.C
new file mode 100644
index 0000000..8000295
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/template-params-11.C
@@ -0,0 +1,9 @@
+// PR c++/54410
+// { dg-options "-g -dA" }
+// { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_template_type_param" 1 } }
+
+namespace N {
+ template <class T> struct A { };
+}
+
+N::A<int> a;