re PR fortran/78741 (ICE in gfc_get_symbol_decl, at fortran/trans-decl.c:1534)
[official-gcc.git] / gcc / testsuite / gfortran.dg / inquire_recl_f2018.f90
blobb744e920f7bd4e2b5efddb6f03989a93d1ab4c58
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
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
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
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 end program inqrecl