aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/inquire_recl_f2018.f90
blob: b744e920f7bd4e2b5efddb6f03989a93d1ab4c58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
! { dg-do run }
! PR 53796 INQUIRE(RECL=...)
program inqrecl
  implicit none
  integer(8) :: r
  integer :: r4
  ! F2018 (N2137) 12.10.2.26: recl for unconnected should be -1
  inquire(10, recl=r)
  if (r /= -1) then
     STOP 1
  end if
  
  ! Formatted sequential
  open(10, status="scratch")
  inquire(10, recl=r)
  inquire(10, recl=r4)
  close(10)
  if (r /= huge(0_8) - huge(0_4) - 1) then
     STOP 2
  end if
  if (r4 /= huge(0)) then
     STOP 3
  end if

  ! Formatted sequential with recl= specifier
  open(10, status="scratch", recl=100)
  inquire(10, recl=r)
  close(10)
  if (r /= 100) then
     STOP 4
  end if

  ! Formatted stream
  ! F2018 (N2137) 12.10.2.26: If unit is connected
  ! for stream access, recl should be assigned the value -2.
  open(10, status="scratch", access="stream")
  inquire(10, recl=r)
  close(10)
  if (r /= -2) then
     STOP 5
  end if
end program inqrecl