[PATCH] PR debug/51032 - ICE in dbxout_type, at dbxout.c:2372

Dodji Seketeli dodji@redhat.com
Tue Nov 8 21:37:00 GMT 2011


Hello,

Member alias templates don't have the DECL_IGNORED_P property set to 1
so that the debug info backend doesn't ignore it.  I didn't notice
that on my DWARF enabled platform because the dwarf backend ignores
DECLs it doesn't know about.  The stabs backend is not that forgiving.

I noticed that other parts of the code were using
check_member_template to ensure that member templates have that
property properly set, so I have adapted it to accept alias templates
and reused it.

This is being bootstrapped on x86_64-unknown-linux-gnu against trunk
at the moment.

From: Dodji Seketeli <dodji@redhat.com>
Date: Tue, 8 Nov 2011 21:28:12 +0100
Subject: [PATCH] PR debug/51032 - ICE in dbxout_type, at dbxout.c:2372

gcc/cp/

	* decl2.c (check_member_template): Accept alias templates and ...
	* parser.c (cp_parser_alias_declaration): ... use it here.

gcc/testsuite/

	* g++.dg/cpp0x/alias-decl-debug-0.C: New test.
---
 gcc/cp/decl2.c                                  |    1 +
 gcc/cp/parser.c                                 |   11 +++++++++--
 gcc/testsuite/g++.dg/cpp0x/alias-decl-debug-0.C |   11 +++++++++++
 3 files changed, 21 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-debug-0.C

diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 3dc5a69..4e24755 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -495,6 +495,7 @@ check_member_template (tree tmpl)
   decl = DECL_TEMPLATE_RESULT (tmpl);
 
   if (TREE_CODE (decl) == FUNCTION_DECL
+      || DECL_ALIAS_TEMPLATE_P (tmpl)
       || (TREE_CODE (decl) == TYPE_DECL
 	  && MAYBE_CLASS_TYPE_P (TREE_TYPE (decl))))
     {
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 12f3c40..fde4c6d 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -14932,6 +14932,7 @@ cp_parser_alias_declaration (cp_parser* parser)
   location_t id_location;
   cp_declarator *declarator;
   cp_decl_specifier_seq decl_specs;
+  bool member_p;
 
   /* Look for the `using' keyword.  */
   cp_parser_require_keyword (parser, RID_USING, RT_USING);
@@ -14957,7 +14958,8 @@ cp_parser_alias_declaration (cp_parser* parser)
   declarator = make_id_declarator (NULL_TREE, id, sfk_none);
   declarator->id_loc = id_location;
 
-  if (at_class_scope_p ())
+  member_p = at_class_scope_p ();
+  if (member_p)
     decl = grokfield (declarator, &decl_specs, NULL_TREE, false,
 		      NULL_TREE, attributes);
   else
@@ -14976,7 +14978,12 @@ cp_parser_alias_declaration (cp_parser* parser)
   if (DECL_LANG_SPECIFIC (decl)
       && DECL_TEMPLATE_INFO (decl)
       && PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (decl)))
-    decl = DECL_TI_TEMPLATE (decl);
+    {
+      decl = DECL_TI_TEMPLATE (decl);
+      if (member_p)
+	check_member_template (decl);
+    }
+
   return decl;
 }
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-debug-0.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-debug-0.C
new file mode 100644
index 0000000..4c00bdd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-debug-0.C
@@ -0,0 +1,11 @@
+// Origin: PR c++/51032
+// { dg-options "-std=c++0x -gstabs+" }
+
+template <class C>
+struct A {
+    template<class U> using B = U*;
+    int a;
+};
+
+A<int> a;
+
-- 
1.7.6.4


-- 
		Dodji



More information about the Gcc-patches mailing list