This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch] libgfortran: write_float bug


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); 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]