This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Fortran, Patch] PR 34192 - Fix compile-time evaluation of NEAREST
- From: FX Coudert <fxcoudert at gmail dot com>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: "'fortran at gcc dot gnu dot org'" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 24 Nov 2007 11:41:42 +0100
- Subject: Re: [Fortran, Patch] PR 34192 - Fix compile-time evaluation of NEAREST
- References: <4747316F.6060708@net-b.de>
PS: Any idea how to test for INF and NAN? If I do "0.0/0.0" I get a
compile-time error and -fno-range-check does not help. I cannot assign
to a variable first as otherwise NEAREST is not evaluated at
compile time.
You should be able to get an NaN by 0. / 0. with -fno-range-check,
and same for Inf:
real, parameter :: x = 0. / 0.
real, parameter :: y = exp(log(huge(y))+20)
print *, x, y
end
PS: can someone confirm that the following is wrong?
$ cat a.f90
real, parameter :: y = exp(log(huge(y))+20)
real, parameter :: x = log(y)
print *, x, y
end
$ gfortran a.f90 -fno-range-check && ./a.out
108.72284 +Infinity