Avoid emitting bogus debug info that confuses gdb.
authorJim Wilson <wilson@gcc.gnu.org>
Thu, 21 Apr 2005 00:06:34 +0000 (17:06 -0700)
committerJim Wilson <wilson@gcc.gnu.org>
Thu, 21 Apr 2005 00:06:34 +0000 (17:06 -0700)
PR c++/20805
* dwarf2out.c (gen_variable_die): Don't emit a specification if this
is another declaration.

From-SVN: r98473

gcc/dwarf2out.c

index b750ff8b466e876eb8ade530edf6af4d56c8c9e8..c32c545477f423ac028d88a60cb2015df9ab5b87 100644 (file)
@@ -11615,8 +11615,13 @@ gen_variable_die (tree decl, dw_die_ref context_die)
      copy decls and set the DECL_ABSTRACT flag on them instead of
      sharing them.
 
-     ??? Duplicated blocks have been rewritten to use .debug_ranges.  */
-  else if (old_die && TREE_STATIC (decl)
+     ??? Duplicated blocks have been rewritten to use .debug_ranges.
+
+     ??? The declare_in_namespace support causes us to get two DIEs for one
+     variable, both of which are declarations.  We want to avoid considering
+     one to be a specification, so we must test that this DIE is not a
+     declaration.  */
+  else if (old_die && TREE_STATIC (decl) && ! declaration
           && get_AT_flag (old_die, DW_AT_declaration) == 1)
     {
       /* This is a definition of a C++ class level static.  */