public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/45048] New: duplicate DW_TAG_variable
@ 2010-07-23 17:54 tromey at gcc dot gnu dot org
2010-07-23 21:06 ` [Bug debug/45048] " tromey at gcc dot gnu dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: tromey at gcc dot gnu dot org @ 2010-07-23 17:54 UTC (permalink / raw)
To: gcc-bugs
Consider this test case:
namespace S
{
int i = 24;
int f() {
extern int i;
return i;
}
};
When I compile this with g++ svn head (as of a few days ago) I see a
duplicate DW_TAG_variable:
<2><3d>: Abbrev Number: 4 (DW_TAG_variable)
<3e> DW_AT_name : i
<40> DW_AT_decl_file : 1
<41> DW_AT_decl_line : 6
<42> DW_AT_MIPS_linkage_name: (indirect string, offset: 0xb): _ZN1S1iE
<46> DW_AT_type : <0x5c>
<4a> DW_AT_external : 1
<4b> DW_AT_declaration : 1
<2><4c>: Abbrev Number: 4 (DW_TAG_variable)
<4d> DW_AT_name : i
<4f> DW_AT_decl_file : 1
<50> DW_AT_decl_line : 3
<51> DW_AT_MIPS_linkage_name: (indirect string, offset: 0xb): _ZN1S1iE
<55> DW_AT_type : <0x5c>
<59> DW_AT_external : 1
<5a> DW_AT_declaration : 1
I think the first one is bogus, given its line number.
--
Summary: duplicate DW_TAG_variable
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tromey at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45048
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug debug/45048] duplicate DW_TAG_variable
2010-07-23 17:54 [Bug debug/45048] New: duplicate DW_TAG_variable tromey at gcc dot gnu dot org
@ 2010-07-23 21:06 ` tromey at gcc dot gnu dot org
2010-07-27 10:40 ` jakub at gcc dot gnu dot org
2010-07-27 11:14 ` jakub at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: tromey at gcc dot gnu dot org @ 2010-07-23 21:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from tromey at gcc dot gnu dot org 2010-07-23 21:06 -------
I suppose the duplicate is due to the "i" inside of "f".
But inside of f I see:
<2><78>: Abbrev Number: 7 (DW_TAG_lexical_block)
<79> DW_AT_low_pc : 0x3
<7d> DW_AT_high_pc : 0x8
<3><81>: Abbrev Number: 4 (DW_TAG_variable)
<82> DW_AT_name : i
<84> DW_AT_decl_file : 1
<85> DW_AT_decl_line : 6
<86> DW_AT_MIPS_linkage_name: (indirect string, offset: 0xb): _ZN1S1iE
<8a> DW_AT_type : <0x5c>
<8e> DW_AT_external : 1
<8f> DW_AT_declaration : 1
I think this would be clearer if "i" were declared using DW_AT_import,
or at the very least using the outer declaration as a specification.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45048
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug debug/45048] duplicate DW_TAG_variable
2010-07-23 17:54 [Bug debug/45048] New: duplicate DW_TAG_variable tromey at gcc dot gnu dot org
2010-07-23 21:06 ` [Bug debug/45048] " tromey at gcc dot gnu dot org
@ 2010-07-27 10:40 ` jakub at gcc dot gnu dot org
2010-07-27 11:14 ` jakub at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-07-27 10:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jakub at gcc dot gnu dot org 2010-07-27 10:39 -------
One of these DW_TAG_variable DIEs at the DW_TAG_namespace scope is created
from declare_in_namespace when processing decls_for_scope of a lexical block.
The other one comes from declare_in_namespace from dwarf2out_global_decl
from wrapup_globals_for_namespace.
The problem is that the C++ FE doesn't unify externs, so the debugger sees
different decls with the same name, but different DECL_UID.
So for say
namespace N
{
int i;
void foo (void)
{
{ extern int i; i++; }
{ extern int i; i++; }
{ extern int i; i++; }
{ extern int i; i++; }
}
}
there will be 5 DW_TAG_variable DIEs in DW_TAG_namespace.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dodji at gcc dot gnu dot
| |org, jason at gcc dot gnu
| |dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45048
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug debug/45048] duplicate DW_TAG_variable
2010-07-23 17:54 [Bug debug/45048] New: duplicate DW_TAG_variable tromey at gcc dot gnu dot org
2010-07-23 21:06 ` [Bug debug/45048] " tromey at gcc dot gnu dot org
2010-07-27 10:40 ` jakub at gcc dot gnu dot org
@ 2010-07-27 11:14 ` jakub at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-07-27 11:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jakub at gcc dot gnu dot org 2010-07-27 11:14 -------
Perhaps a question is whether we need to actually call gen_decl_die in
declare_in_namespace if local_scope_p (context_die). AFAIK we don't use the
DW_TAG_variable from the namespace scope in any attributes...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45048
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-07-27 11:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-23 17:54 [Bug debug/45048] New: duplicate DW_TAG_variable tromey at gcc dot gnu dot org
2010-07-23 21:06 ` [Bug debug/45048] " tromey at gcc dot gnu dot org
2010-07-27 10:40 ` jakub at gcc dot gnu dot org
2010-07-27 11:14 ` jakub at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).