This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch] libgfortran: write_float bug
- From: Andreas Krebbel <krebbel1 at de dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: fortran at gcc dot gnu dot org
- Date: Wed, 7 Jul 2004 11:09:31 +0200
- Subject: [Patch] libgfortran: write_float bug
- Organization: IBM Entwicklung GmbH
Hello,
on s390 the nan_inf_fmt.f90 testcase in the
libgfortran.fortran-torture testsuite fails due to a missing length
check in io/write.c:write_float.
The attached patch adds the necessary check.
I think the patch can be considered obvious, so I didn't bootstrap
gcc.
OK?
Bye
-Andreas-
2004-07-07 Andreas Krebbel <krebbel1@de.ibm.com>
* libgfortran/io/write.c: (write_float): Added length check.
Index: libgfortran/io/write.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/write.c,v
retrieving revision 1.7
diff -p -c -r1.7 write.c
*** libgfortran/io/write.c 28 Jun 2004 01:30:26 -0000 1.7
--- libgfortran/io/write.c 7 Jul 2004 08:55:30 -0000
*************** write_float (fnode *f, const char *sourc
*** 535,541 ****
memcpy(p + nb - 8, "Infinity", 8);
else
memcpy(p + nb - 3, "Inf", 3);
! if (nb < 8)
memset(p + nb - 4, fin, 1);
else if (nb > 8)
memset(p + nb - 9, fin, 1);
--- 535,541 ----
memcpy(p + nb - 8, "Infinity", 8);
else
memcpy(p + nb - 3, "Inf", 3);
! if (nb < 8 && nb > 3)
memset(p + nb - 4, fin, 1);
else if (nb > 8)
memset(p + nb - 9, fin, 1);