From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9431 invoked by alias); 6 Mar 2007 08:20:36 -0000 Received: (qmail 9350 invoked by uid 48); 6 Mar 2007 08:20:23 -0000 Date: Tue, 06 Mar 2007 08:20:00 -0000 Message-ID: <20070306082023.9349.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug libfortran/31052] Bad IOSTAT values when readings NAMELISTs past EOF In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "anlauf at gmx dot de" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-03/txt/msg00377.txt.bz2 ------- 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