public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/45020] New: Useless DW_TAG_variable generated
@ 2010-07-21 17:13 jakub at gcc dot gnu dot org
2010-07-21 18:00 ` [Bug c/45020] " jakub at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-07-21 17:13 UTC (permalink / raw)
To: gcc-bugs
The C FE (unlike C++) generates extra DW_TAG_variable in the debug info for
e.g.
extern int v;
__typeof (v) v;
or
extern int v;
__typeof (v) w;
int v = 456;
or
extern int v;
int foo (void) { return v; }
int v;
The first one gives with -g -dA:
.uleb128 0x2 # (DIE (0x2d) DW_TAG_variable)
.ascii "v\0" # DW_AT_name
.byte 0x1 # DW_AT_decl_file (u.c)
.byte 0x1 # DW_AT_decl_line
.long 0x38 # DW_AT_type
.byte 0x1 # DW_AT_external
.byte 0x1 # DW_AT_declaration
.uleb128 0x3 # (DIE (0x38) DW_TAG_base_type)
.byte 0x4 # DW_AT_byte_size
.byte 0x5 # DW_AT_encoding
.ascii "int\0" # DW_AT_name
.uleb128 0x4 # (DIE (0x3f) DW_TAG_variable)
.ascii "v\0" # DW_AT_name
.byte 0x1 # DW_AT_decl_file (u.c)
.byte 0x2 # DW_AT_decl_line
.long 0x38 # DW_AT_type
.byte 0x1 # DW_AT_external
.byte 0x9 # DW_AT_location
.byte 0x3 # DW_OP_addr
.quad v
The first decl is olddecl from merge_decls, while the second one is newdecl
from it (from the last one of them).
--
Summary: Useless DW_TAG_variable generated
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jakub at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45020
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/45020] Useless DW_TAG_variable generated
2010-07-21 17:13 [Bug c/45020] New: " jakub at gcc dot gnu dot org
@ 2010-07-21 18:00 ` jakub at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-07-21 18:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from jakub at gcc dot gnu dot org 2010-07-21 18:00 -------
Another testcase:
extern int v;
extern __typeof (v) v;
extern __typeof (v) v;
When the old extern decl isn't TREE_USED, it doesn't make it into debug info:
case VAR_DECL:
/* Ignore this VAR_DECL if it refers to a file-scope extern data object
declaration and if the declaration was never even referenced from
within this entire compilation unit. We suppress these DIEs in
order to save space in the .debug section (by eliminating entries
which are probably useless). Note that we must not suppress
block-local extern declarations (whether used or not) because that
would screw-up the debugger's name lookup mechanism and cause it to
miss things which really ought to be in scope at a given point. */
if (DECL_EXTERNAL (decl) && !TREE_USED (decl))
return;
I wonder if there is any point in keeping TREE_USED set on olddecl after
merge_decls if olddecl was DECL_EXTERNAL. If there is, other options could be
DECL_IGNORED_P on the DECL_EXTERNAL olddecl, or redirecting it to the newdecl.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |roland at redhat dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45020
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-03-25 9:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-45020-4@http.gcc.gnu.org/bugzilla/>
2014-03-25 9:16 ` [Bug c/45020] Useless DW_TAG_variable generated mpolacek at gcc dot gnu.org
2010-07-21 17:13 [Bug c/45020] New: " jakub at gcc dot gnu dot org
2010-07-21 18:00 ` [Bug c/45020] " 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).