Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gfortran.dg/read_no_eor.f90 @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 ! { dg-do run } | |
2 ! Handle eor and eof conditions with missing eor in file. | |
3 ! Test case modified from case presented by Ian Harvey on clf. | |
4 program eieio_stat | |
5 use, intrinsic :: iso_fortran_env, only: iostat_end, iostat_eor | |
6 implicit none | |
7 integer, parameter :: unit=10 | |
8 integer :: ios1, ios2, ios3 | |
9 character(25) :: buffer | |
10 character(100) :: themessage | |
11 !**** | |
12 open(10,file="eieio", form="unformatted", access="stream", status="replace") | |
13 write(10) "Line-1" // char(10) | |
14 write(10) "Line-2" | |
15 close(10) | |
16 | |
17 open(10,file="eieio") | |
18 | |
19 buffer = 'abcdefg' | |
20 read (unit,"(a)",advance="no",iostat=ios1, pad="yes") buffer | |
21 if (ios1 /= iostat_eor .and. buffer /= "Line-1") call abort | |
22 | |
23 buffer = '<' | |
24 read (unit,"(a)",advance="no",iostat=ios2,pad="yes") buffer | |
25 if (ios2 /= iostat_eor .and. buffer /= "Line-2") call abort | |
26 | |
27 buffer = '5678' | |
28 read (unit,"(a)",advance="no",iostat=ios3, iomsg=themessage) buffer | |
29 if (ios3 /= iostat_end .and. buffer /= "5678") call abort | |
30 | |
31 rewind(10) | |
32 | |
33 buffer = "abcdefg" | |
34 read (unit,"(a)",advance="no",iostat=ios1, pad="no") buffer | |
35 if (ios1 /= iostat_eor .and. buffer /= "abcdefg") call abort | |
36 | |
37 buffer = '<' | |
38 read (unit,"(a)",advance="no",iostat=ios2,pad="no") buffer | |
39 if (ios2 /= iostat_eor .and. buffer /= "<") call abort | |
40 | |
41 buffer = '1234' | |
42 read (unit,"(a)",advance="no",iostat=ios3, iomsg=themessage) buffer | |
43 if (ios3 <= 0 .and. buffer /= "1234") call abort | |
44 | |
45 close(unit, status="delete") | |
46 end program eieio_stat |