This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/31052] Bad IOSTAT values when readings NAMELISTs past EOF
- From: "anlauf at gmx dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Mar 2007 08:20:23 -0000
- Subject: [Bug libfortran/31052] Bad IOSTAT values when readings NAMELISTs past EOF
- References: <bug-31052-6318@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from anlauf at gmx dot de 2007-03-06 08:20 -------
(In reply to comment #2)
> The value 5008 is listed in libgfortran.h as ERROR_ENDFILE. The
> -1 corresponds to ERROR_END. So, the return value of 5008 is
> telling you that you are trying to (initiate a?) read beyond
> the end of the file, which you admit to doing.
I actually do not want to read beyond the end of file,
I want gfortran to stay at the end of the file when trying to
read the next record or namelist.
All other compilers I have checked (xlf, ifort 7.x-9.x, g95)
stay at the end of file. I find their behavior consistent
with the F2003 standard, section 9.10.4:
Execution of an input/output statement containing the IOSTAT=
specifier causes the scalar-int-variable in the IOSTAT= specifier
to become defined with
(3) The processor-dependent negative integer value of the constant
IOSTAT_END (13.8.2.5) if an end-of-file condition occurs and no
error condition occurs, or (...)
> AFAIK, the IOSTAT values aren't documented in gfortran.texi.
> Someday, someone will get around to documenting them.
The standard separates end-of-file, end-of-record, and
error conditions. I don't think that EOF is necessarily
an error condition. It would be nice if gfortran would
conform with these other compilers.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31052