public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paul Brook <paul@codesourcery.com>
To: fortran@gcc.gnu.org
Cc: Andreas Krebbel <krebbel1@de.ibm.com>, gcc-patches@gcc.gnu.org
Subject: Re: [Patch] libgfortran: write_float bug
Date: Thu, 08 Jul 2004 21:18:00 -0000	[thread overview]
Message-ID: <200407082057.12570.paul@codesourcery.com> (raw)
In-Reply-To: <200407071109.31583.krebbel1@de.ibm.com>

> 2004-07-07  Andreas Krebbel <krebbel1@de.ibm.com>
>
> 	* 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);

      reply	other threads:[~2004-07-08 19:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-07  9:40 Andreas Krebbel
2004-07-08 21:18 ` Paul Brook [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200407082057.12570.paul@codesourcery.com \
    --to=paul@codesourcery.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=krebbel1@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).