File: file_48.f90

package info (click to toggle)
lfortran 0.60.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 58,416 kB
  • sloc: cpp: 173,406; f90: 80,491; python: 17,586; ansic: 9,610; yacc: 2,356; sh: 1,401; fortran: 895; makefile: 38; javascript: 15
file content (39 lines) | stat: -rw-r--r-- 955 bytes parent folder | download
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
program daio4
  implicit none

  integer, parameter :: unit_no = 24
  integer :: i, i1, iolen
  logical :: l, pf
  character(4) :: s
  real :: r
  complex :: c
  complex, parameter :: cval = (12.34, 56.78)

!  inquire (iolength=iolen) l, s, i, r, c  ! Causes ICE: see PR #9761
!
! So I hard code iolen. 
  iolen = 24
  open (unit_no, file='fort.24', access='direct', recl=iolen)

  do, i=1, 10
    l = mod (i,2) == 0
    write (unit_no, rec=i) l, 'wxyz', i, i+0.5, cval
  end do

! Read fails to read correctly:
  do, i=1, 10
    l = .false.; s = 'uini'; i1 = -42; r = -42.42
    read (unit_no, rec=i) l, s, i1, r, c
    pf = (l .eqv. mod (i, 2) == 0) .and. &
         (s == 'wxyz') .and.  &
         (i == i1) .and.  &
         (abs (r - (i + 0.5)) < 0.0001) .and.  &
         (c == cval)
    print *, 'l, s, i1, r =', l, s, i1, r, c
    print *, 'read', i, merge ('pass', 'fail', pf)
    if (.not. pf) error stop
  end do

  close (unit_no)

end program