| 1 |
!{ dg-do run } |
| 2 |
!{ dg-options "-fno-range-check" } |
| 3 |
!{ dg-add-options ieee } |
| 4 |
! PR19310 and PR19904, allow disabling range check during compile. |
| 5 |
! Contributed by Jerry DeLisle <[email protected]> |
| 6 |
program main |
| 7 |
character(len=80) str |
| 8 |
real, parameter :: zero=0, nan=0/zero |
| 9 |
complex :: z = (-0.1,-2.2)/(0.0,0.0) |
| 10 |
complex :: z2 = (0.1,1)/0 |
| 11 |
complex :: z3 = (1e35, -2e3)/1.234e-37 |
| 12 |
complex :: z4 = (1e-35, -2e-35)/1234e34 |
| 13 |
real :: a |
| 14 |
a = exp(1000.0) |
| 15 |
b = 1/exp(1000.0) |
| 16 |
|
| 17 |
write(str,*) a |
| 18 |
if (trim(adjustl(str)) .ne. 'Infinity') STOP 1 |
| 19 |
|
| 20 |
if (b .ne. 0.) STOP 2 |
| 21 |
|
| 22 |
write(str,*) -1.0/b |
| 23 |
if (trim(adjustl(str)) .ne. '-Infinity') STOP 3 |
| 24 |
|
| 25 |
write(str,*) b/0.0 |
| 26 |
if (trim(adjustl(str)) .ne. 'NaN') STOP 4 |
| 27 |
|
| 28 |
write(str,*) 0.0/0.0 |
| 29 |
if (trim(adjustl(str)) .ne. 'NaN') STOP 5 |
| 30 |
|
| 31 |
write(str,*) 1.0/(-0.) |
| 32 |
if (trim(adjustl(str)) .ne. '-Infinity') STOP 6 |
| 33 |
|
| 34 |
write(str,*) -2.0/0. |
| 35 |
if (trim(adjustl(str)) .ne. '-Infinity') STOP 7 |
| 36 |
|
| 37 |
write(str,*) 3.0/0. |
| 38 |
if (trim(adjustl(str)) .ne. 'Infinity') STOP 8 |
| 39 |
|
| 40 |
write(str,*) nan |
| 41 |
if (trim(adjustl(str)) .ne. 'NaN') STOP 9 |
| 42 |
|
| 43 |
write(str,*) z |
| 44 |
if (trim(adjustl(str)) .ne. '(NaN,NaN)') STOP 10 |
| 45 |
|
| 46 |
write(str,*) z2 |
| 47 |
if (trim(adjustl(str)) .ne. '(NaN,NaN)') STOP 11 |
| 48 |
|
| 49 |
write(str,*) z3 |
| 50 |
if (trim(adjustl(str)) .ne. '(Inf,-Inf)') STOP 12 |
| 51 |
|
| 52 |
write(str,*) z4 |
| 53 |
if (trim(adjustl(str)) .ne. '(0.00000000,-0.00000000)') STOP 13 |
| 54 |
end program main |