| 1 |
! { dg-do run } |
| 2 |
! PR 53796 INQUIRE(RECL=...) |
| 3 |
program inqrecl |
| 4 |
implicit none |
| 5 |
integer(8) :: r |
| 6 |
integer :: r4 |
| 7 |
! F2018 (N2137) 12.10.2.26: recl for unconnected should be -1 |
| 8 |
inquire(10, recl=r) |
| 9 |
if (r /= -1) then |
| 10 |
STOP 1 |
| 11 |
end if |
| 12 |
|
| 13 |
! Formatted sequential |
| 14 |
open(10, status="scratch") |
| 15 |
inquire(10, recl=r) |
| 16 |
inquire(10, recl=r4) |
| 17 |
close(10) |
| 18 |
if (r /= huge(0_8) - huge(0_4) - 1) then |
| 19 |
STOP 2 |
| 20 |
end if |
| 21 |
if (r4 /= huge(0)) then |
| 22 |
STOP 3 |
| 23 |
end if |
| 24 |
|
| 25 |
! Formatted sequential with recl= specifier |
| 26 |
open(10, status="scratch", recl=100) |
| 27 |
inquire(10, recl=r) |
| 28 |
close(10) |
| 29 |
if (r /= 100) then |
| 30 |
STOP 4 |
| 31 |
end if |
| 32 |
|
| 33 |
! Formatted stream |
| 34 |
! F2018 (N2137) 12.10.2.26: If unit is connected |
| 35 |
! for stream access, recl should be assigned the value -2. |
| 36 |
open(10, status="scratch", access="stream") |
| 37 |
inquire(10, recl=r) |
| 38 |
close(10) |
| 39 |
if (r /= -2) then |
| 40 |
STOP 5 |
| 41 |
end if |
| 42 |
|
| 43 |
! Also inquire by filename for a non-opened unit is considered |
| 44 |
! unconnected similar to the first test. |
| 45 |
inquire(file='unconnectedfile.txt', recl=r) |
| 46 |
if (r /= -1) then |
| 47 |
stop 6 |
| 48 |
end if |
| 49 |
end program inqrecl |