:ADDPATCH fortran:
The program (to be compiled with -fno-range-check)
real, parameter :: nan = 0.0/0.0
if (nan == nan) call abort()
print *, max(nan, 4.0) ! shall print "4.0"
should not abort as (nan /= nan) shall evaluate as true. This patch
ensures that comparisons and MIN/MAX work properly for NaN, by using
mpfr_min and mpfr_max instead of home-grown mpfr_cmp/mpfr_set solutions.
It additionally replaces mpfr_cmp by mpfr_equal_p etc. which take NaN
into account. I had to pass the wanted argument to gfc_compare_expr to
ensure that for "nan > nan", "nan < nan" and "nan == nan" the result is
always false.
Build and regression tested on x86-64-linux.
OK for the trunk?
Tobias
PS: I essentially copied the test case nan_1.f90 and changed the
variables to parameters.