annotate gcc/testsuite/gfortran.dg/read_no_eor.f90 @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ! { dg-do run }
kono
parents:
diff changeset
2 ! Handle eor and eof conditions with missing eor in file.
kono
parents:
diff changeset
3 ! Test case modified from case presented by Ian Harvey on clf.
kono
parents:
diff changeset
4 program eieio_stat
kono
parents:
diff changeset
5 use, intrinsic :: iso_fortran_env, only: iostat_end, iostat_eor
kono
parents:
diff changeset
6 implicit none
kono
parents:
diff changeset
7 integer, parameter :: unit=10
kono
parents:
diff changeset
8 integer :: ios1, ios2, ios3
kono
parents:
diff changeset
9 character(25) :: buffer
kono
parents:
diff changeset
10 character(100) :: themessage
kono
parents:
diff changeset
11 !****
kono
parents:
diff changeset
12 open(10,file="eieio", form="unformatted", access="stream", status="replace")
kono
parents:
diff changeset
13 write(10) "Line-1" // char(10)
kono
parents:
diff changeset
14 write(10) "Line-2"
kono
parents:
diff changeset
15 close(10)
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 open(10,file="eieio")
kono
parents:
diff changeset
18
kono
parents:
diff changeset
19 buffer = 'abcdefg'
kono
parents:
diff changeset
20 read (unit,"(a)",advance="no",iostat=ios1, pad="yes") buffer
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
21 if (ios1 /= iostat_eor .and. buffer /= "Line-1") STOP 1
111
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 buffer = '<'
kono
parents:
diff changeset
24 read (unit,"(a)",advance="no",iostat=ios2,pad="yes") buffer
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
25 if (ios2 /= iostat_eor .and. buffer /= "Line-2") STOP 2
111
kono
parents:
diff changeset
26
kono
parents:
diff changeset
27 buffer = '5678'
kono
parents:
diff changeset
28 read (unit,"(a)",advance="no",iostat=ios3, iomsg=themessage) buffer
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
29 if (ios3 /= iostat_end .and. buffer /= "5678") STOP 3
111
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 rewind(10)
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 buffer = "abcdefg"
kono
parents:
diff changeset
34 read (unit,"(a)",advance="no",iostat=ios1, pad="no") buffer
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
35 if (ios1 /= iostat_eor .and. buffer /= "abcdefg") STOP 4
111
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 buffer = '<'
kono
parents:
diff changeset
38 read (unit,"(a)",advance="no",iostat=ios2,pad="no") buffer
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
39 if (ios2 /= iostat_eor .and. buffer /= "<") STOP 5
111
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 buffer = '1234'
kono
parents:
diff changeset
42 read (unit,"(a)",advance="no",iostat=ios3, iomsg=themessage) buffer
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
43 if (ios3 <= 0 .and. buffer /= "1234") STOP 6
111
kono
parents:
diff changeset
44
kono
parents:
diff changeset
45 close(unit, status="delete")
kono
parents:
diff changeset
46 end program eieio_stat