Skip to content

Commit 6c8e9b6

Browse files
author
Jay Satish Kumar Patel
committed
added write-after-endfile testcase
1 parent 2126d7b commit 6c8e9b6

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
program test_io_err
2+
3+
implicit none
4+
integer :: n, k, l
5+
logical :: ok
6+
7+
ok = .true.
8+
9+
open(5, err=500, iostat=n)
10+
k = 45
11+
goto 505
12+
500 continue
13+
k = 46
14+
505 continue
15+
print *, 'k after OPEN:', k
16+
ok = ok .and. (k == 45)
17+
18+
close(5, err=510, iostat=n)
19+
k = 55
20+
goto 515
21+
510 continue
22+
k = 56
23+
515 continue
24+
print *, 'k after CLOSE:', k
25+
ok = ok .and. (k == 55)
26+
27+
read(5, err=520, iostat=n) l
28+
k = 65
29+
goto 523
30+
520 continue
31+
k = 66
32+
523 continue
33+
print *, 'iostat after read:', n, ' k:', k
34+
ok = ok .and. (k == 66)
35+
36+
l = 34
37+
write(5, err=525, iostat=n) l
38+
k = 65
39+
goto 528
40+
525 continue
41+
k = 66
42+
528 continue
43+
print *, 'iostat after write:', n, ' k:', k
44+
ok = ok .and. (k == 66)
45+
46+
if (ok) then
47+
print *, 'PASS'
48+
else
49+
print *, 'FAIL'
50+
end if
51+
52+
end program test_io_err

0 commit comments

Comments
 (0)