2017-12-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / inquire_recl_f2018.f90
blob8a1334029fceb7dedd67b76ed47b9223df5144e5
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 call abort()
11 end if
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 call abort()
20 end if
21 if (r4 /= huge(0)) then
22 call abort()
23 end if
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 call abort()
31 end if
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 call abort()
41 end if
42 end program inqrecl