annotate gcc/testsuite/gfortran.dg/read_eof_all.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 ! PR43265 Followup patch for miscellaneous EOF conditions.
kono
parents:
diff changeset
3 ! Eaxamples from Tobius Burnus
kono
parents:
diff changeset
4 use iso_fortran_env
kono
parents:
diff changeset
5 character(len=2) :: str, str2(2)
kono
parents:
diff changeset
6 integer :: a, b, c, ios
kono
parents:
diff changeset
7 str = ''
kono
parents:
diff changeset
8 str2 = ''
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 open(99,file='test.dat',access='stream',form='unformatted', status='replace')
kono
parents:
diff changeset
11 write(99) ' '
kono
parents:
diff changeset
12 close(99)
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14 open(99,file='test.dat')
kono
parents:
diff changeset
15 read(99, '(T7,i2)') i
kono
parents:
diff changeset
16 close(99, status="delete")
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
17 if (i /= 0) STOP 1
111
kono
parents:
diff changeset
18
kono
parents:
diff changeset
19 read(str(1:0), '(T7,i1)') i
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
20 if (i /= 0) STOP 2
111
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 read(str,'(i2,/,i2)',end=111) a, b
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
23 STOP 3!stop 'ERROR: Expected EOF error (1)'
111
kono
parents:
diff changeset
24 111 continue
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 read(str2,'(i2,/,i2)',end=112) a, b
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 read(str2,'(i2,/,i2,/,i2)',end=113) a, b, c
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
29 STOP 4!stop 'ERROR: Expected EOF error (2)'
111
kono
parents:
diff changeset
30
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
31 112 STOP 5!stop 'ERROR: Unexpected EOF (3)'
111
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 113 continue
kono
parents:
diff changeset
34 read(str,'(i2,/,i2)',end=121,pad='no') a, b
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
35 STOP 6!stop 'ERROR: Expected EOF error (1)'
111
kono
parents:
diff changeset
36 121 continue
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 read(str2(:),'(i2,/,i2)', end=122, pad='no') a, b
kono
parents:
diff changeset
39 goto 125
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
40 122 STOP 7!stop 'ERROR: Expected no EOF error (2)'
111
kono
parents:
diff changeset
41 125 continue
kono
parents:
diff changeset
42
kono
parents:
diff changeset
43 read(str2(:),'(i2,/,i2,/,i2)',end=123,pad='no') a, b, c
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
44 STOP 8!stop 'ERROR: Expected EOF error (3)'
111
kono
parents:
diff changeset
45 123 continue
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 read(str(2:1),'(i2,/,i2)',end=131, pad='no') a, b
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
48 STOP 9!stop 'ERROR: Expected EOF error (1)'
111
kono
parents:
diff changeset
49 131 continue
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 read(str2(:)(2:1),'(i2,/,i2)',end=132, pad='no') a, b
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
52 STOP 10!stop 'ERROR: Expected EOF error (2)'
111
kono
parents:
diff changeset
53 132 continue
kono
parents:
diff changeset
54
kono
parents:
diff changeset
55 read(str2(:)(2:1),'(i2,/,i2,/,i2)',end=133,pad='no') a, b, c
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
56 STOP 11!stop 'ERROR: Expected EOF error (3)'
111
kono
parents:
diff changeset
57 133 continue
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 read(str(2:1),'(i2,/,i2)',iostat=ios, pad='no') a, b
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
60 if (ios /= IOSTAT_END) STOP 12!stop 'ERROR: expected iostat /= 0 (1)'
111
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 read(str2(:)(2:1),'(i2,/,i2)',iostat=ios, pad='no') a, b
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
63 if (ios /= IOSTAT_END) STOP 13!stop 'ERROR: expected iostat /= 0 (2)'
111
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 read(str2(:)(2:1),'(i2,/,i2,/,i2)',iostat=ios,pad='no') a, b, c
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
66 if (ios /= IOSTAT_END) STOP 14!stop 'ERROR: expected iostat /= 0 (2)'
111
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 ! print *, "success"
kono
parents:
diff changeset
69 end
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71