From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12968 invoked by alias); 10 Aug 2012 12:57:25 -0000 Received: (qmail 12950 invoked by uid 22791); 10 Aug 2012 12:57:23 -0000 X-SWARE-Spam-Status: No, hits=-4.1 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,MSGID_FROM_MTA_HEADER,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e06smtp13.uk.ibm.com (HELO e06smtp13.uk.ibm.com) (195.75.94.109) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 10 Aug 2012 12:57:09 +0000 Received: from /spool/local by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 10 Aug 2012 13:57:07 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 10 Aug 2012 13:56:49 +0100 Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps4074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q7ACuhg626542254; Fri, 10 Aug 2012 12:56:43 GMT Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q7ACumZv013165; Fri, 10 Aug 2012 06:56:48 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id q7ACukE5013146; Fri, 10 Aug 2012 06:56:46 -0600 Message-Id: <201208101256.q7ACukE5013146@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Fri, 10 Aug 2012 14:56:46 +0200 Subject: Re: Memory corruption for host double format different from target double format To: yao@codesourcery.com (Yao Qi) Date: Fri, 10 Aug 2012 12:57:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org, thomas@codesourcery.com (Thomas Schwinge), gdb@sourceware.org In-Reply-To: <6114731.htKcOdL0z6@qiyao.dyndns.org> from "Yao Qi" at Aug 10, 2012 06:37:01 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit x-cbid: 12081012-2966-0000-0000-000004F70690 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-08/txt/msg00314.txt.bz2 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_double_bit > > may have been called setting it unequal to the 64-bit double format. > > Hmm, and gdbarch.c:verify_gdbarch has the following comment on top of it: > > Ensure that all values in a GDBARCH are reasonable. ;-) > > Looks like some checking like this is missing? > > gdbarch->float_format->totalsize <= gdbarch->float_bit > gdbarch->double_format->totalsize <= gdbarch->double_bit 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.) 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 ... [ I guess we could also hunt down and remove the final few places that still create a TYPE_CODE_FLT with no format set; then the floatflormat_from_length routine could go away completely. ] Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com