From 5f0e85625f8ad6e9a5c2feb48190b9ed8fb34ef8 Mon Sep 17 00:00:00 2001 From: pbrook <pbrook@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Thu, 8 Jul 2004 19:58:56 +0000 Subject: [PATCH] PR fortran/16291 * libgfortran/io/write.c: (write_float): Added length check. Remove pointless memset calls. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84308 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgfortran/ChangeLog | 10 ++++++++-- libgfortran/io/write.c | 6 +++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 14a6349f0231..8458be34da26 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2004-07-08 Andreas Krebbel <krebbel1@de.ibm.com> + + PR fortran/16291 + * libgfortran/io/write.c: (write_float): Added length check. + Remove pointless memset calls. + 2004-07-04 Bud Davis <bdavis9659@comcast.net> Paul Brook <paul@codesourcery.com> @@ -5,9 +11,9 @@ * io/transfer.c(us_write): set recl for seq unform writes to max size. * io/transfer.c(data_transfer_init): handle un-opened seq unform unit. * io/unix.c(fd_alloc_w_at): handle requests at start, fd_flush at - right time. + right time. * io/unix.c(is_seekable): set based upon the file/device, not the - method being used to access it (fd or mmap). + method being used to access it (fd or mmap). * io/unix.c(fd_flush): don't set file_size if !seekable. * io/unix.c(fd_truncate: ditto. diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index 3602c1b9157d..749a34a48341 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -535,10 +535,10 @@ write_float (fnode *f, const char *source, int len) 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); -- GitLab