From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32762 invoked by alias); 30 Aug 2012 15:38:23 -0000 Received: (qmail 32743 invoked by uid 22791); 30 Aug 2012 15:38:20 -0000 X-SWARE-Spam-Status: No, hits=-7.7 required=5.0 tests=AWL,BAYES_00,KHOP_PGP_SIGNED,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 30 Aug 2012 15:38:05 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1T76oi-0001uj-7o from Thomas_Schwinge@mentor.com ; Thu, 30 Aug 2012 08:38:00 -0700 Received: from SVR-IES-FEM-02.mgc.mentorg.com ([137.202.0.106]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Thu, 30 Aug 2012 08:38:00 -0700 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.1.289.1; Thu, 30 Aug 2012 16:37:57 +0100 From: Thomas Schwinge To: CC: , , Mark Kettenis , , Kevin Buettner , Subject: Re: Memory corruption for host double format different from target double format In-Reply-To: <876281lnft.fsf@schwinge.name> References: <201208101256.q7ACukE5013146@d06av02.portsmouth.uk.ibm.com> <201208101431.q7AEVlMM027471@glazunov.sibelius.xs4all.nl> <876281lnft.fsf@schwinge.name> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Thu, 30 Aug 2012 15:38:00 -0000 Message-ID: <873934l7au.fsf@schwinge.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2012-08/txt/msg00094.txt.bz2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 5377 Hi! On Wed, 29 Aug 2012 17:36:54 +0200, I wrote: > On Fri, 10 Aug 2012 16:31:47 +0200, Mark Kettenis wrote: > > > Date: Fri, 10 Aug 2012 14:56:46 +0200 (CEST) > > > From: "Ulrich Weigand" > > >=20 > > > Yao Qi wrote: > > > > On Friday, August 10, 2012 11:32:53 AM Thomas Schwinge wrote: > > > > > That is, if set_gdbarch_double_format has not been called, it will > > > > > default to floatformats_ieee_double -- even though set_gdbarch_do= uble_bit > > > > > may have been called setting it unequal to the 64-bit double form= at. > > > > > Hmm, and gdbarch.c:verify_gdbarch has the following comment on to= p of it: > > > > > Ensure that all values in a GDBARCH are reasonable. ;-) > > > >=20 > > > > Looks like some checking like this is missing? > > > >=20 > > > > gdbarch->float_format->totalsize <=3D gdbarch->float_bit > > > > gdbarch->double_format->totalsize <=3D gdbarch->double_bit > > >=20 > > > In fact, I'd prefer to make gdbarch_double_format etc. *mandatory* > > > and gdbarch_double_bit etc. optional, defaulting to the format size. > > > (Currently, _bit is mandatory and _format is optional.) > > >=20 > > > This would mean that nearly all calls to set_gdbarch_double_bit > > > could go away, with the exception of special cases like "long double" > > > on i386 ... > >=20 > > Initializing _bit based on _format by default makes sense, but I don't > > think this is easy to implement given the way how the gdbarch.c code > > is generated. > >=20 > > Making _format mandatory doesn't make sense to me though. I'd say > > that ieee_single and ieee_double are perfectly reasonable defaults for > > float_format and double_format. >=20 > Is there a reasonable way for at least detecting the mismatch that I > happened to observe for SH? >=20 >=20 > Other than that, OK to check in the following? I have only tested the SH > bits; no maintainer listed for h8300, Stephane CCed for m68hc11. Stephane Carrez' email address (as listed in gdb/MAINTAINERS) bounces saying =C2=BBunknown user=C2=AB, but I found anoth= er one in the GCC context -- Stephane, is this you? If yes, please update the three occurences of your old email address in gdb/MAINTAINERS (and possibly other files, too). Kevin, I'm also adding you to the CC list, as you've been helpful with SH issues before -- should you be listed as a maintainer for SH? And what about the h8300 bits? > gdb/ > * h8300-tdep.c (h8300_gdbarch_init): Invoke > set_gdbarch_double_format and set_gdbarch_long_double_format. > * m68hc11-tdep.c (m68hc11_gdbarch_init): Invoke > set_gdbarch_double_format. > * sh-tdep.c (sh_gdbarch_init): Likewise. >=20 > diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c > index 7fc4daa..bcb769e 100644 > --- a/gdb/h8300-tdep.c > +++ b/gdb/h8300-tdep.c > @@ -1351,7 +1351,9 @@ h8300_gdbarch_init (struct gdbarch_info info, struc= t gdbarch_list *arches) > set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT); > set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT); > set_gdbarch_double_bit (gdbarch, 4 * TARGET_CHAR_BIT); > + set_gdbarch_double_format (gdbarch, floatformats_ieee_single); > set_gdbarch_long_double_bit (gdbarch, 4 * TARGET_CHAR_BIT); > + set_gdbarch_long_double_format (gdbarch, floatformats_ieee_single); >=20=20 > set_gdbarch_believe_pcc_promotion (gdbarch, 1); >=20=20 > diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c > index 79629ef..cd32459 100644 > --- a/gdb/m68hc11-tdep.c > +++ b/gdb/m68hc11-tdep.c > @@ -1498,7 +1498,16 @@ m68hc11_gdbarch_init (struct gdbarch_info info, > set_gdbarch_short_bit (gdbarch, 16); > set_gdbarch_int_bit (gdbarch, elf_flags & E_M68HC11_I32 ? 32 : 16); > set_gdbarch_float_bit (gdbarch, 32); > - set_gdbarch_double_bit (gdbarch, elf_flags & E_M68HC11_F64 ? 64 : 32); > + if (elf_flags & E_M68HC11_F64) > + { > + set_gdbarch_double_bit (gdbarch, 64); > + set_gdbarch_double_format (gdbarch, floatformats_ieee_double); > + } > + else > + { > + set_gdbarch_double_bit (gdbarch, 32); > + set_gdbarch_double_format (gdbarch, floatformats_ieee_single); > + } > set_gdbarch_long_double_bit (gdbarch, 64); > set_gdbarch_long_bit (gdbarch, 32); > set_gdbarch_ptr_bit (gdbarch, 16); > diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c > index 1ede13a..caf940d 100644 > --- a/gdb/sh-tdep.c > +++ b/gdb/sh-tdep.c > @@ -2299,6 +2299,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct g= dbarch_list *arches) > case bfd_mach_sh2e: > /* doubles on sh2e and sh3e are actually 4 byte. */ > set_gdbarch_double_bit (gdbarch, 4 * TARGET_CHAR_BIT); > + set_gdbarch_double_format (gdbarch, floatformats_ieee_single); >=20=20 > set_gdbarch_register_name (gdbarch, sh_sh2e_register_name); > set_gdbarch_register_type (gdbarch, sh_sh3e_register_type); > @@ -2344,6 +2345,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct g= dbarch_list *arches) > case bfd_mach_sh2a_or_sh3e: > /* doubles on sh2e and sh3e are actually 4 byte. */ > set_gdbarch_double_bit (gdbarch, 4 * TARGET_CHAR_BIT); > + set_gdbarch_double_format (gdbarch, floatformats_ieee_single); >=20=20 > set_gdbarch_register_name (gdbarch, sh_sh3e_register_name); > set_gdbarch_register_type (gdbarch, sh_sh3e_register_type); Gr=C3=BC=C3=9Fe, Thomas --=-=-= Content-Type: application/pgp-signature Content-length: 489 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEcBAEBAgAGBQJQP4jJAAoJENuKOtuXzphJEOIH+wTLSQq+4IgeLcsz4POHnvSy ziyNEn6/a045bXpQwnYBXfoeCtsR5Y+y2UCXNmjlSkiBdyk4OY+GASHPBOUCxzCN rp3UOWtM7zE0pp402Mffo06jNkP8lrCah0OfSg9MnFLF9f7/z0vSPMG/uFXRy7uL rqEh7nIge5gBz0VorSCheQ9pa/L1NA3JFHKhB5jE1ivfNyQuuHNliXU7MPbBjXcr IhzIIuJ2KQd0SOsFrp43QyUqXF4YOSQbGhBAYBNHnIXnOStSATXOtyovYM+MfXLh d+e/00TJo5516P+IEHO2oHXflTCRh+dewBuXa33KEw1/jQ5JI0Ey0TrrPvZdNho= =OlcT -----END PGP SIGNATURE----- --=-=-=--