annotate gcc/testsuite/gfortran.dg/read_list_eof_1.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 ! PR 49296 List formatted read of file without EOR marker (\n).
kono
parents:
diff changeset
3 program read_list_eof_1
kono
parents:
diff changeset
4 implicit none
kono
parents:
diff changeset
5 character(len=100) :: s
kono
parents:
diff changeset
6 integer :: ii
kono
parents:
diff changeset
7 real :: rr
kono
parents:
diff changeset
8 logical :: ll
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 call genfil ('a')
kono
parents:
diff changeset
11 open (unit=20, file='read.dat', form='FORMATTED', action='READ', &
kono
parents:
diff changeset
12 status='OLD')
kono
parents:
diff changeset
13 read (20, fmt=*) s
kono
parents:
diff changeset
14 close (20, status='delete')
kono
parents:
diff changeset
15 if (trim(s) /= "a") then
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
16 STOP 1
111
kono
parents:
diff changeset
17 end if
kono
parents:
diff changeset
18
kono
parents:
diff changeset
19 call genfil ('1')
kono
parents:
diff changeset
20 open (unit=20, file='read.dat', form='FORMATTED', action='READ', &
kono
parents:
diff changeset
21 status='OLD')
kono
parents:
diff changeset
22 read (20, fmt=*) ii
kono
parents:
diff changeset
23 close (20, status='delete')
kono
parents:
diff changeset
24 if (ii /= 1) then
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
25 STOP 2
111
kono
parents:
diff changeset
26 end if
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 call genfil ('1.5')
kono
parents:
diff changeset
29 open (unit=20, file='read.dat', form='FORMATTED', action='READ', &
kono
parents:
diff changeset
30 status='OLD')
kono
parents:
diff changeset
31 read (20, fmt=*) rr
kono
parents:
diff changeset
32 close (20, status='delete')
kono
parents:
diff changeset
33 if (rr /= 1.5) then
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
34 STOP 3
111
kono
parents:
diff changeset
35 end if
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 call genfil ('T')
kono
parents:
diff changeset
38 open (unit=20, file='read.dat', form='FORMATTED', action='READ', &
kono
parents:
diff changeset
39 status='OLD')
kono
parents:
diff changeset
40 read (20, fmt=*) ll
kono
parents:
diff changeset
41 close (20, status='delete')
kono
parents:
diff changeset
42 if (.not. ll) then
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
43 STOP 4
111
kono
parents:
diff changeset
44 end if
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 contains
kono
parents:
diff changeset
47 subroutine genfil(str)
kono
parents:
diff changeset
48 character(len=*), intent(in) :: str
kono
parents:
diff changeset
49 open(10, file='read.dat', form='unformatted', action='write', &
kono
parents:
diff changeset
50 status='replace', access='stream')
kono
parents:
diff changeset
51 write(10) str
kono
parents:
diff changeset
52 close(10)
kono
parents:
diff changeset
53 end subroutine genfil
kono
parents:
diff changeset
54 end program read_list_eof_1