This is the mail archive of the
mailing list for the GCC project.
[Bug c/33440] New: gcc-compiled program possibly reporting wrong variable address to gdb
- From: "sethdgrover at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Sep 2007 22:50:35 -0000
- Subject: [Bug c/33440] New: gcc-compiled program possibly reporting wrong variable address to gdb
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
gcc (GCC) 4.1.2 (Ubuntu 4.1.2-0ubuntu4) from Ubuntu repositories
Ubuntu 7.04 2.6.20-16-generic kernel
GNU gdb 6.6-debian
I run this program in GDB, and put a breakpoing right before the call to
whatever(). At this point, I print "a", and the value is no good, but the
variable is uninitialized so that's expected. However, after the other
statements which set the value of "a", printing "a" still show the
This was compiled simply using "gcc -g test.c" and run using "gdb ./a.out".
=== test.c ===============
void whatever ()
a = 123;
a = 321;
It looks like gdb decodes the address as 4 bytes too low, gcc says its location
is DW_OP_fbreg -16. I don't know if this is a gdb or a gcc problem, but from
what I've been told a variable not updating is almost always a compiler bug.
I've also submitted the issue to gdb's bugtracking system
(http://sourceware.org/cgi-bin/gnatsweb.pl) as issue 2319.
Summary: gcc-compiled program possibly reporting wrong variable
address to gdb
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sethdgrover at gmail dot com