This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gfortran] patch for pr12839 / F2003 format of Inf and NaN
On Sat, 2004-06-12 at 07:14, Paul Brook wrote:
> Ok. (the version that uses memcpy)
> Paul
freebsd was getting test fails after this was committed. seems that
isinf() is not the same between glibc and freebsd's libc.
added a check to explicitly check the sign for infinity.
test passes on i686/gnu/linux and i386/FreeBSD 5.2.1-RELEASE.
Change Log:
2004-06-13 Bud Davis <bdavis9659@comcast.net>
PR gfortran/12839
*io/write.c (write_float): check signbit for Infinity.
--bud
Index: gcc/libgfortran/io/write.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/write.c,v
retrieving revision 1.6
diff -c -3 -p -r1.6 write.c
*** gcc/libgfortran/io/write.c 12 Jun 2004 12:50:51 -0000 1.6
--- gcc/libgfortran/io/write.c 13 Jun 2004 12:39:56 -0000
*************** write_float (fnode *f, const char *sourc
*** 523,535 ****
}
memset(p, ' ', nb);
! res = isinf (n);
if (res != 0)
{
! if (res > 0)
! fin = '+';
! else
fin = '-';
if (nb > 7)
memcpy(p + nb - 8, "Infinity", 8);
--- 523,535 ----
}
memset(p, ' ', nb);
! res = isinf (n);
if (res != 0)
{
! if (signbit(n))
fin = '-';
+ else
+ fin = '+';
if (nb > 7)
memcpy(p + nb - 8, "Infinity", 8);