Gdb on a 64 bit executable - cannot access memory

Hi,
Can anyone explain this please.....

A simple test program...

### snip

#include <stdio.h>

main() {
static int n;

n = 6;

printf("hello %d\n", n);
n=7;
}

### snip

64 bit compile/link....

$ export OBJECT_MODE=64
$ cc -g -o hello hello.c
$ gdb ./hello
(gdb) b 8
Breakpoint 1 at 0x1000004a4: file hello.c, line 8.
(gdb) r
Starting program: /src/kiwi_7.94_01oct2014/hello 

Breakpoint 1, main () at hello.c:8
8       printf("hello %d\n", n);
(gdb) p n
Cannot access memory at address 0x10000708
(gdb) 

If you take off the "static" on line 4, it works fine. :confused:

Also it works fine in 32 bit mode.

Looks like a bug.

It works fine with my 64-bit gcc and gdb, which are:

$ gcc --version
gcc (Gentoo 4.7.3-r1 p1.4, pie-0.5.5) 4.7.3
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gdb --version
GNU gdb (Gentoo 7.6.2 p1) 7.6.2
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>.

$