This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/33440] New: gcc-compiled program possibly reporting wrong variable address to gdb

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
uninitialized value.

This was compiled simply using "gcc -g test.c" and run using "gdb ./a.out".

=== test.c ===============
main (
  int argc,
  char *argv[])
  int a;

  void whatever ()
    a = 123;

  a = 321;

  return 0;

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
( as issue 2319.


Seth Grover

           Summary: gcc-compiled program possibly reporting wrong variable
                    address to gdb
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sethdgrover at gmail dot com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]