[LLVMbugs] [Bug 3224] New: Debug information says all members at offset 0

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Dec 16 15:01:58 PST 2008


           Summary: Debug information says all members at offset 0
           Product: tools
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: llvm-gcc
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: jyasskin at google.com
                CC: llvmbugs at cs.uiuc.edu

Created an attachment (id=2309)
 --> (http://llvm.org/bugs/attachment.cgi?id=2309)
Sample program showing incorrect debug information

$ ~/opensource/llvm-gcc/trunk/install/bin/llvm-gcc -g  -o bad_types bad_types.c
$ gdb bad_types
GNU gdb 6.8-gg11
Copyright (C) 2008 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-linux"...
(gdb) b main
Breakpoint 1 at 0x400438: file bad_types.c, line 7.
(gdb) run
Starting program: /home/jyasskin/tmp/bad_types 

Breakpoint 1, main () at bad_types.c:7
7         struct Foo f = {4, 7};
(gdb) n
8         return 0;
(gdb) p /x f
$1 = {
  bar = 0x4, 
  baz = 0x959e0004
(gdb) p &f  
$2 = (struct Foo *) 0x7fff959e9a20
(gdb) p &f.bar
$3 = (short int *) 0x7fff959e9a20
(gdb) p &f.baz
$4 = (int *) 0x7fff959e9a20

Notice that Foo::bar and Foo::baz are claimed to be at the same address despite
being different members.

Needless to say, this makes it very hard to debug programs. You can work around
it by manually computing the offset of the member you want, adding some number
of bytes to a pointer by hand, and then casting it back to the right type, but
that's not really reasonable.

This is an llvm-gcc built from svn r60958. The 2.4 release did not have this

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list