This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
Re: c++/1936: Wrong address of struct member
- From: Daniel Jacobowitz <drow at false dot org>
- To: nobody at sources dot redhat dot com
- Cc: gdb-prs at sources dot redhat dot com,
- Date: 3 May 2005 14:58:02 -0000
- Subject: Re: c++/1936: Wrong address of struct member
- Reply-to: Daniel Jacobowitz <drow at false dot org>
The following reply was made to PR c++/1936; it has been noted by GNATS.
From: Daniel Jacobowitz <drow@false.org>
To: c_keil@yahoo.de
Cc: gdb-gnats@sources.redhat.com
Subject: Re: c++/1936: Wrong address of struct member
Date: Tue, 3 May 2005 10:54:51 -0400
On Tue, May 03, 2005 at 02:26:43PM -0000, c_keil@yahoo.de wrote:
>
> >Number: 1936
> >Category: c++
> >Synopsis: Wrong address of struct member
> >Confidential: no
> >Severity: serious
> >Priority: medium
> >Responsible: unassigned
> >State: open
> >Class: sw-bug
> >Submitter-Id: net
> >Arrival-Date: Tue May 03 14:28:03 UTC 2005
> >Closed-Date:
> >Last-Modified:
> >Originator: c_keil@yahoo.de
> >Release: gdb-6.3
> >Organization:
> >Environment:
> SuSE Linux 9.0
> output of uname -a:
> Linux xxx 2.4.21-286-smp4G #1 SMP Sat Apr 2 09:08:57 UTC 2005 i686 i686 i386 GNU/Linux
> >Description:
> Gdb seems to judge the size of the bool type different from gcc (which should presumably be the reference, as the program is running fine on its own).
> >How-To-Repeat:
> Compile the program with -g (I was using g++-3.3.1 from SuSE Linux). Open program in debugger and set breakpoint after printf line. Run and compare the output with
> "p &t.d".
This was a bug in GCC 3.3.x. It produces:
<1><372e>: Abbrev Number: 20 (DW_TAG_structure_type)
DW_AT_sibling : <37a1>
DW_AT_name : st
DW_AT_byte_size : 12
DW_AT_decl_file : 1
DW_AT_decl_line : 4
<2><3739>: Abbrev Number: 21 (DW_TAG_member)
DW_AT_name : b
DW_AT_decl_file : 1
DW_AT_decl_line : 5
DW_AT_type : <37a1>
DW_AT_data_member_location: 2 byte block: 23 0 (DW_OP_plus_uconst: 0)
<2><3745>: Abbrev Number: 21 (DW_TAG_member)
DW_AT_name : d
DW_AT_decl_file : 1
DW_AT_decl_line : 6
DW_AT_type : <37a9>
DW_AT_data_member_location: 2 byte block: 23 8 (DW_OP_plus_uconst: 8)
That says the double is padded to +8 in the structure, but the program
shows it is only padded to +4.
If I compile using g++ 3.4, I get the right result.
--
Daniel Jacobowitz
CodeSourcery, LLC