This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix DW_AT_import for C++ using of a base type typedef


As described in

namespace A
  typedef int B;

main ()
  using A::B;
  B b;
  return b;

we are emitting incorrect DW_AT_import, it refers to an unnamed int type
rather than the A::B typedef DIE.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok
for trunk?

2009-06-30  Jakub Jelinek  <>

	* dwarf2out.c (dwarf2out_imported_module_or_decl_1): If imported
	decl is non-redundant typedef, force creation of a typedef DIE
	and use that in DW_AT_import.

--- gcc/dwarf2out.c.jj	2009-06-12 15:00:38.000000000 +0200
+++ gcc/dwarf2out.c	2009-06-24 13:45:45.000000000 +0200
@@ -15825,7 +15825,9 @@ dwarf2out_imported_module_or_decl_1 (tre
   if (TREE_CODE (decl) == TYPE_DECL || TREE_CODE (decl) == CONST_DECL)
-      if (is_base_type (TREE_TYPE (decl)))
+      if (TREE_CODE (decl) == TYPE_DECL && !is_redundant_typedef (decl))
+	at_import_die = NULL;
+      else if (is_base_type (TREE_TYPE (decl)))
 	at_import_die = base_type_die (TREE_TYPE (decl));
 	at_import_die = force_type_die (TREE_TYPE (decl));


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]