Merge -r 127928:132243 from trunk
[official-gcc.git] / gcc / testsuite / gfortran.dg / module_nan.f90
blob956b90c49d48ab066de2f41e5aebbca63b4b3083
1 ! { dg-do run }
2 ! { dg-options "-fno-range-check" }
3 ! { dg-options "-fno-range-check -mieee" { target sh*-*-* } }
5 ! PR fortran/34318
7 ! Infinity and NaN were not properly written to the .mod file.
9 module nonordinal
10 implicit none
11 real, parameter :: inf = 1./0., nan = 0./0., minf = -1./0.0
12 end module nonordinal
14 program a
15 use nonordinal
16 implicit none
17 character(len=20) :: str
18 if (log(abs(inf)) < huge(inf)) call abort()
19 if (log(abs(minf)) < huge(inf)) call abort()
20 if (.not. isnan(nan)) call abort()
21 write(str,*) inf
22 if (adjustl(str) /= "+Infinity") call abort()
23 write(str,*) minf
24 if (adjustl(str) /= "-Infinity") call abort()
25 write(str,*) nan
26 if (adjustl(str) /= "NaN") call abort()
27 end program a
29 ! { dg-final { cleanup-modules "nonordinal" } }