This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/24685] real(16) formatted input is broken for huge values (gfortran.dg/default_format_2.f90)
- From: "fxcoudert at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Feb 2008 20:10:57 -0000
- Subject: [Bug libfortran/24685] real(16) formatted input is broken for huge values (gfortran.dg/default_format_2.f90)
- References: <bug-24685-8500@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #30 from fxcoudert at gcc dot gnu dot org 2008-02-23 20:10 -------
On powerpc-apple-darwin9.2, gfortran.dg/large_real_kind_form_io_2.f90 fails for
that reason:
$ cat a.f90
real(kind=16) :: a,b
character(len=180) :: tmp
b = 8.98846567431157953864652595394501287669662887245e307_16
write (tmp, *) b
read (tmp, *) a
write(*,"(G70.55E4)") b
write(*,"(G70.55E4)") a
write(*,"(G70.55E4)") a-b
if (a /= b) print *, "#####"
end
$ ./bin/gfortran a.f90 && ./a.out
0.8988465674311579538646525953945123668100000000000000000E+0308
0.8988465674311579538646525953945123668100000000000000000E+0308
0.1107913932560222642718302084617242634400000000000000000E+0277
#####
But, as the following C testcase shows, that's not a gfortran problem, but
rather a libc issue on darwin:
$ cat a.c
#include <stdio.h>
#include <string.h>
int main(void) {
long double x, y = 8.98846567431157953864652595394501287669662887245e307L;
char buf[79];
memset (buf, ' ', sizeof(buf));
sprintf (buf, "%60.70Lg", y);
puts (buf);
sscanf (buf, "%Lg", &x);
memset (buf, ' ', sizeof(buf));
sprintf (buf, "%60.70Lg", x);
puts (buf);
printf ("%60.70Lg\n", x-y);
return 0;
}
$ gcc a.c && ./a.out
8.988465674311579538646525953945123668089884894711532863671504057886634e+307
8.988465674311579538646525953945123668089884894711532863671504057886634e+307
1.107913932560222642718302084617242634394213707491304322373697056856707e+276
I have reported that issue to Apple as radar #5761818, we'll see if it is
fixed, but I doubt it (no new PowerPC sold by Apple, and generally little
interest in long double). I have thus XFAILed
gfortran.dg/large_real_kind_form_io_2.f90 on powerpc*-apple-darwin*.
As comment #27 says, this doesn't fail on sparc-solaris, I'm closing this as
INVALID. Please reopen if you have a testcase on another target where the issue
is not due to a faulty libc.
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685