The subject says it all:

void foo(void)
{
  int a = 0;

  void bar(void)
  {
    a = 1;
  }

  bar ();
  a = a + 1;
}

int main(void)
{
  foo ();
}


GNU gdb 6.4
Copyright 2005 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i586-suse-linux"...Using host libthread_db library
"/lib/tls/libthread_db.so.1".

(gdb) b t.c:11
Breakpoint 1 at 0x8048389: file t.c, line 11.
(gdb) run
Starting program: /home/eric/gnat/bugs/F318-004/t

Breakpoint 1, foo () at t.c:11
11        a = a + 1;
(gdb) p a
$1 = -12412
(gdb) next
12      }
(gdb) p a
$2 = -12412


-- 
           Summary: [4.0/4.1/4.2 Regression] Wrong debug info for variable
                    accessed non-locally
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ebotcazou at gcc dot gnu dot org
 GCC build triplet: *-*-*
  GCC host triplet: *-*-*
GCC target triplet: *-*-*


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

Reply via email to