[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / gfortran.dg / nan_6.f90
blobf4adcd2100d90beb47ec228d10500c1912d66659
1 ! { dg-do run }
2 ! { dg-add-options ieee }
3 ! { dg-skip-if "NaN not supported" { spu-*-* } }
5 ! List-directed part of PR fortran/43298
6 ! and follow up to PR fortran/34319.
8 ! Check handling of "NAN(alphanum)"
10 character(len=200) :: str
11 real :: r
12 complex :: z
14 ! read_real:
16 r = 1.0
17 str = 'INfinity' ; read(str,*) r
18 if (r < 0 .or. r /= r*1.1) call abort()
20 r = 1.0
21 str = '-INF' ; read(str,*) r
22 if (r > 0 .or. r /= r*1.1) call abort()
24 r = 1.0
25 str = '+INF' ; read(str,*) r
26 if (r < 0 .or. r /= r*1.1) call abort()
28 r = 1.0
29 str = '-inFiniTY' ; read(str,*) r
30 if (r > 0 .or. r /= r*1.1) call abort()
32 r = 1.0
33 str = 'NAN' ; read(str,*) r
34 if (.not. isnan(r)) call abort()
36 r = 1.0
37 str = '-NAN' ; read(str,*) r
38 if (.not. isnan(r)) call abort()
40 r = 1.0
41 str = '+NAN' ; read(str,*) r
42 if (.not. isnan(r)) call abort()
44 r = 1.0
45 str = 'NAN(0x111)' ; read(str,*) r
46 if (.not. isnan(r)) call abort()
48 r = 1.0
49 str = '-NAN(123)' ; read(str,*) r
50 if (.not. isnan(r)) call abort()
52 r = 1.0
53 str = '+NAN(0xFFE)' ; read(str,*) r
54 if (.not. isnan(r)) call abort()
57 ! parse_real
59 z = cmplx(-2.0,-4.0)
60 str = '(0.0,INfinity)' ; read(str,*) z
61 if (aimag(z) < 0 .or. aimag(z) /= aimag(z)*1.1) call abort()
63 z = cmplx(-2.0,-4.0)
64 str = '(-INF,0.0)' ; read(str,*) z
65 if (real(z) > 0 .or. real(z) /= real(z)*1.1) call abort()
67 z = cmplx(-2.0,-4.0)
68 str = '(0.0,+INF)' ; read(str,*) z
69 if (aimag(z) < 0 .or. aimag(z) /= aimag(z)*1.1) call abort()
71 z = cmplx(-2.0,-4.0)
72 str = '(-inFiniTY,0.0)' ; read(str,*) z
73 if (real(z) > 0 .or. real(z) /= real(z)*1.1) call abort()
75 z = cmplx(-2.0,-4.0)
76 str = '(NAN,0.0)' ; read(str,*) z
77 if (.not. isnan(real(z))) call abort()
79 z = cmplx(-2.0,-4.0)
80 str = '(0.0,-NAN)' ; read(str,*) z
81 if (.not. isnan(aimag(z))) call abort()
83 z = cmplx(-2.0,-4.0)
84 str = '(+NAN,0.0)' ; read(str,*) z
85 if (.not. isnan(real(z))) call abort()
87 z = cmplx(-2.0,-4.0)
88 str = '(NAN(0x111),0.0)' ; read(str,*) z
89 if (.not. isnan(real(z))) call abort()
91 z = cmplx(-2.0,-4.0)
92 str = '(0.0,-NaN(123))' ; read(str,*) z
93 if (.not. isnan(aimag(z))) call abort()
95 z = cmplx(-2.0,-4.0)
96 str = '(+nan(0xFFE),0.0)' ; read(str,*) z
97 if (.not. isnan(real(z))) call abort()
99 end