This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Mar 2010 09:49:49 -0000
- Subject: [Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file
- References: <bug-43265-14178@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #10 from burnus at gcc dot gnu dot org 2010-03-06 09:49 -------
In terms of the standard, probably everything is OK for I/O: "The set of
input/output error conditions is processor dependent." (See "9.11.1 General"
for a non-definition when EOF occurs.)
Looking at other compilers:
* If "X" is the only edit descriptor and there is no <EOR> marker left in the
input buffer (i.e. no '\n'), an End Of File error occurs. (gfortran: No error -
this PR)
* If one reads, e.g. "i2" from a record where either only a record marker
follows or only the end-of-file, one reads the value "0" and no error occurs.
(gfortran: No error if record marker follows, but error if only eof follows.
Note that reading '(a)' from "a<eof>" does not give an error while reading from
"<eof>" gives an error.)
* If one reads "(i2,100x,i2,100x)" or "(100x,2i2)" from a record, one gets two
"0" and no error, independent whether the record buffer contains "<eof>",
"<eor><eof>" or " <eof>". (gfortran: If there is a record marker, the result
is the same; otherwise an EOF error occurs, unless two integer values could be
read - then the trailing "100x" does not cause any error.)
I think the result of the other compilers is sensible.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43265