http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60060

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue is that we create the DIE for the namelist before we've emitted
DIEs for global vars.  Thus we run into

static dw_die_ref
gen_namelist_decl (tree name, dw_die_ref scope_die, tree item_decls)
{
...
  FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (item_decls), i, value)
    {
      nml_item_ref_die = lookup_decl_die (value);
      if (!nml_item_ref_die)
        nml_item_ref_die = force_decl_die (value);

which forces the creation of a DIE for mem_nml as context of nxc and
creates a declaration DIE of nxc in that context.

The actual AT_specification is added when we output debuginfo for mem_nml
but then again via emit_debug_global_declarations.

Without LTO we don't call dwarf2out_global_decl on mem_nml::NXC.

I believe that somehow we have to honor TREE_ASM_WRITTEN here to avoid
outputting the decl twice ...?

That said, frontends disconnect on what are "globals" is obviously an
area to improve upon ... as is removing the various langhooks around
this area (write_global_declarations) in the light of cgraph/varpool/symtab.

Reply via email to