public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/16788] New: [3.3 regression] Incorrect DWARF-2 offset for long long struct member
@ 2004-07-27 19:37 kmassey at incipient dot com
  2004-07-27 19:44 ` [Bug debug/16788] " bangerth at dealii dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: kmassey at incipient dot com @ 2004-07-27 19:37 UTC (permalink / raw)
  To: gcc-bugs

gcc 3.3.1 produces incorrect DWARF-2 offset for a long long struct member.

Reproduced in gcc 3.3.1 and 3.3.4.
Not reproducible in gcc 3.2.2.

To reproduce:

------- bug.c --------------------------------
int
main()
{
  struct foo {
    char c;
    long long l;
  };

  struct foo f;
  int i;

  i = (char *)&f.l - (char *)&f;

  return 0;
}
----------------------------------------------

$ gcc -v -gdwarf-2 bug.c
Reading specs from /usr/lib/gcc-lib/i686-redhat-linux/3.3.1/specs
Configured with: ../configure --prefix=/usr --enable-shared --enable-threads --
disable-nls i686-redhat-linux
Thread model: posix
gcc version 3.3.1
 /usr/lib/gcc-lib/i686-redhat-linux/3.3.1/cc1 -quiet -v -D__GNUC__=3 -
D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=1 bug.c -quiet -dumpbase bug.c -auxbase 
bug -gdwarf-2 -version -o /tmp/ccJzm0tb.s
GNU C version 3.3.1 (i686-redhat-linux)
        compiled by GNU C version 3.3.1.
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64222
ignoring nonexistent directory "/usr/i686-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc-lib/i686-redhat-linux/3.3.1/include
 /usr/include
End of search list.
 as -V -Qy -o /tmp/ccUw4qEb.o /tmp/ccJzm0tb.s
GNU assembler version 2.13.90.0.2 (i386-redhat-linux) using BFD version 
2.13.90.0.2 20020802
 /usr/lib/gcc-lib/i686-redhat-linux/3.3.1/collect2 --eh-frame-hdr -m elf_i386 -
dynamic-linker /lib/ld-linux.so.2 /usr/lib/gcc-lib/i686-redhat-
linux/3.3.1/../../../crt1.o /usr/lib/gcc-lib/i686-redhat-
linux/3.3.1/../../../crti.o /usr/lib/gcc-lib/i686-redhat-
linux/3.3.1/crtbegin.o -L/usr/lib/gcc-lib/i686-redhat-linux/3.3.1 -
L/usr/lib/gcc-lib/i686-redhat-linux/3.3.1/../../.. /tmp/ccUw4qEb.o -lgcc -
lgcc_eh -lc -lgcc -lgcc_eh /usr/lib/gcc-lib/i686-redhat-
linux/3.3.1/crtend.o /usr/lib/gcc-lib/i686-redhat-linux/3.3.1/../../../crtn.o

$ readelf -wi a.out
[snip]
 <2><c6d>: Abbrev Number: 3 (DW_TAG_structure_type)
     DW_AT_sibling     : <c92>
     DW_AT_name        : foo
     DW_AT_byte_size   : 12
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 4
 <3><c79>: Abbrev Number: 4 (DW_TAG_member)
     DW_AT_name        : c
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 5
     DW_AT_type        : <cb2>
     DW_AT_data_member_location: 2 byte block: 23 0     (DW_OP_plus_uconst: 0; )
 <3><c85>: Abbrev Number: 4 (DW_TAG_member)
     DW_AT_name        : l
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 6
     DW_AT_type        : <cb9>
     DW_AT_data_member_location: 2 byte block: 23 8     (DW_OP_plus_uconst: 8; )
[snip]
----------------------------------------------

Note that the offset of foo.l is 8 instead of the expected 4.

This can be demonstrated under the debugger:

----------------------------------------------
$ gdb ./a.out
GNU gdb Red Hat Linux (5.2.1-4)
Copyright 2002 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 "i386-redhat-linux"...
(gdb) b 14
Breakpoint 1 at 0x8048334: file bug.c, line 14.
(gdb) run
Starting program: /home/kmassey/gcc-bugs/a.out 

Breakpoint 1, main () at bug.c:14
14        return 0;
(gdb) p i
$1 = 4
(gdb) p (char *)&f.l - (char *)&f
$2 = 8
----------------------------------------------

By contrast, -gstabs+ works as expected:

----------------------------------------------
$ gcc -gstabs+ bug.c
[kmassey@kmlx1 gcc-bugs]$ gdb ./a.out
GNU gdb Red Hat Linux (5.2.1-4)
Copyright 2002 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 "i386-redhat-linux"...
(gdb) b 14
Breakpoint 1 at 0x8048334: file bug.c, line 14.
(gdb) run 
Starting program: /home/kmassey/gcc-bugs/a.out 

Breakpoint 1, main () at bug.c:14
14        return 0;
(gdb) p i
$1 = 4
(gdb) p (char *)&f.l - (char *)&f
$2 = 4
----------------------------------------------

-- 
           Summary: [3.3 regression] Incorrect DWARF-2 offset for long long
                    struct member
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kmassey at incipient dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug debug/16788] [3.3 regression] Incorrect DWARF-2 offset for long long struct member
  2004-07-27 19:37 [Bug debug/16788] New: [3.3 regression] Incorrect DWARF-2 offset for long long struct member kmassey at incipient dot com
@ 2004-07-27 19:44 ` bangerth at dealii dot org
  2004-09-28 13:38 ` gdr at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: bangerth at dealii dot org @ 2004-07-27 19:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-07-27 19:44 -------
Confirmed, a regression in 3.3.x over 3.2.x. It is already fixed in 
3.4.0 and mainline, though. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
      Known to fail|                            |3.3.4
      Known to work|                            |3.2.3 3.4.0 3.5.0
   Last reconfirmed|0000-00-00 00:00:00         |2004-07-27 19:44:32
               date|                            |
   Target Milestone|---                         |3.3.5


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug debug/16788] [3.3 regression] Incorrect DWARF-2 offset for long long struct member
  2004-07-27 19:37 [Bug debug/16788] New: [3.3 regression] Incorrect DWARF-2 offset for long long struct member kmassey at incipient dot com
  2004-07-27 19:44 ` [Bug debug/16788] " bangerth at dealii dot org
@ 2004-09-28 13:38 ` gdr at gcc dot gnu dot org
  2004-12-28  2:18 ` pinskia at gcc dot gnu dot org
  2005-04-30 13:52 ` gdr at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: gdr at gcc dot gnu dot org @ 2004-09-28 13:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at gcc dot gnu dot org  2004-09-28 13:38 -------
Adjust milestone

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|3.2.3 3.4.0 4.0             |3.2.3 3.4.0 4.0.0
   Target Milestone|3.3.5                       |3.3.6


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug debug/16788] [3.3 regression] Incorrect DWARF-2 offset for long long struct member
  2004-07-27 19:37 [Bug debug/16788] New: [3.3 regression] Incorrect DWARF-2 offset for long long struct member kmassey at incipient dot com
  2004-07-27 19:44 ` [Bug debug/16788] " bangerth at dealii dot org
  2004-09-28 13:38 ` gdr at gcc dot gnu dot org
@ 2004-12-28  2:18 ` pinskia at gcc dot gnu dot org
  2005-04-30 13:52 ` gdr at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-28  2:18 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-debug
   Last reconfirmed|2004-07-27 19:44:32         |2004-12-28 02:18:47
               date|                            |


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug debug/16788] [3.3 regression] Incorrect DWARF-2 offset for long long struct member
  2004-07-27 19:37 [Bug debug/16788] New: [3.3 regression] Incorrect DWARF-2 offset for long long struct member kmassey at incipient dot com
                   ` (2 preceding siblings ...)
  2004-12-28  2:18 ` pinskia at gcc dot gnu dot org
@ 2005-04-30 13:52 ` gdr at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: gdr at gcc dot gnu dot org @ 2005-04-30 13:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at gcc dot gnu dot org  2005-04-30 13:51 -------
Not critical for 3.3.6.  Fixed in 3.4.0 and higher.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|3.3.6                       |3.4.0


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-04-30 13:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-27 19:37 [Bug debug/16788] New: [3.3 regression] Incorrect DWARF-2 offset for long long struct member kmassey at incipient dot com
2004-07-27 19:44 ` [Bug debug/16788] " bangerth at dealii dot org
2004-09-28 13:38 ` gdr at gcc dot gnu dot org
2004-12-28  2:18 ` pinskia at gcc dot gnu dot org
2005-04-30 13:52 ` gdr at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).