public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/43325]  New: C++ external inner reference does not override outer scope
@ 2010-03-10 19:15 jan dot kratochvil at redhat dot com
  2010-03-31  9:35 ` [Bug debug/43325] [4.5 Regression] " dodji at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jan dot kratochvil at redhat dot com @ 2010-03-10 19:15 UTC (permalink / raw)
  To: gcc-bugs

namespace S
  {
    int f ()
      {
        int i = 42;
        {
          extern int i;
          return i;
        }
      }
  }

generates DWARF:
# Grossly simplified.
 <1><2d>: Abbrev Number: 2 (DW_TAG_namespace)
    <2e>   DW_AT_name        : S
 <2><36>: Abbrev Number: 3 (DW_TAG_subprogram)
    <37>   DW_AT_external    : 1
    <38>   DW_AT_name        : f
    <3c>   DW_AT_MIPS_linkage_name: (indirect string, offset: 0x49): _ZN1S1fEv
    <61>   DW_AT_low_pc      : 0x0
    <69>   DW_AT_high_pc     : 0x13
    <71>   DW_AT_frame_base  : 0x0      (location list)
 <3><75>: Abbrev Number: 7 (DW_TAG_lexical_block)
    <76>   DW_AT_low_pc      : 0x4
    <7e>   DW_AT_high_pc     : 0x11
 <4><86>: Abbrev Number: 8 (DW_TAG_variable)
    <87>   DW_AT_name        : i
    <8f>   DW_AT_location    : 2 byte block: 91 6c      (DW_OP_fbreg: -20)
 <4><92>: Abbrev Number: 9 (DW_TAG_lexical_block)
    <93>   DW_AT_low_pc      : 0xb
    <9b>   DW_AT_high_pc     : 0x11
 <2><45>: Abbrev Number: 4 (DW_TAG_variable)
    <46>   DW_AT_name        : i
    <4a>   DW_AT_MIPS_linkage_name: (indirect string, offset: 0x40): _ZN1S1iE
    <52>   DW_AT_external    : 1
    <53>   DW_AT_declaration : 1

But the last DIE should have been <5><45> being in inner DW_TAG_lexical_block
so that debugger would display external variable S::i in the inner block.

(I have inlined the DW_AT_specification reference in the dump above.)

Similar case in C works OK:
int
f (void)
{
  int i = 42;
  {
    extern int i;
    return i;
  }
}


-- 
           Summary: C++ external inner reference does not override outer
                    scope
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jan dot kratochvil at redhat dot com
GCC target triplet: x86_64-unknown-linux-gnu


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-04-01 18:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-10 19:15 [Bug debug/43325] New: C++ external inner reference does not override outer scope jan dot kratochvil at redhat dot com
2010-03-31  9:35 ` [Bug debug/43325] [4.5 Regression] " dodji at gcc dot gnu dot org
2010-03-31 10:08 ` dodji at gcc dot gnu dot org
2010-04-01 18:55 ` dodji at gcc dot gnu dot org
2010-04-01 18:55 ` dodji 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).