From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6609 invoked by alias); 8 Jul 2004 19:57:18 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 6575 invoked from network); 8 Jul 2004 19:57:17 -0000 Received: from unknown (HELO shockwave.systems.pipex.net) (62.241.160.9) by sourceware.org with SMTP; 8 Jul 2004 19:57:17 -0000 Received: from nowt.org (81-178-213-192.dsl.pipex.com [81.178.213.192]) by shockwave.systems.pipex.net (Postfix) with ESMTP id 2C8DA1C002FC; Thu, 8 Jul 2004 20:57:14 +0100 (BST) Received: from wren.home (wren.home [192.168.1.7]) by nowt.org (Postfix) with ESMTP id C9D58AC92; Thu, 8 Jul 2004 20:57:11 +0100 (BST) From: Paul Brook Organization: CodeSourcery To: fortran@gcc.gnu.org Subject: Re: [Patch] libgfortran: write_float bug Date: Thu, 08 Jul 2004 21:18:00 -0000 User-Agent: KMail/1.6.2 Cc: Andreas Krebbel , gcc-patches@gcc.gnu.org References: <200407071109.31583.krebbel1@de.ibm.com> In-Reply-To: <200407071109.31583.krebbel1@de.ibm.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200407082057.12570.paul@codesourcery.com> X-SW-Source: 2004-07/txt/msg00833.txt.bz2 > 2004-07-07 Andreas Krebbel > > * libgfortran/io/write.c: (write_float): Added length check. Applied, thanks. I also changed the memset calls into direct assignments. Index: write.c =================================================================== RCS file: /var/cvsroot/gcc-cvs/gcc/libgfortran/io/write.c,v retrieving revision 1.7 diff -u -p -r1.7 write.c --- write.c 28 Jun 2004 01:30:26 -0000 1.7 +++ write.c 8 Jul 2004 19:51:19 -0000 @@ -535,10 +535,10 @@ write_float (fnode *f, const char *sourc memcpy(p + nb - 8, "Infinity", 8); else memcpy(p + nb - 3, "Inf", 3); - if (nb < 8) - memset(p + nb - 4, fin, 1); + if (nb < 8 && nb > 3) + p[nb - 4] = fin; else if (nb > 8) - memset(p + nb - 9, fin, 1); + p[nb - 9] = fin; } else memcpy(p + nb - 3, "NaN", 3);