With a simple data file: $ cat file.dat 1 2 3 $ wc file.dat 3 3 6 file.dat
the following code: $ cat aa.f90 program fred implicit none integer::i,badness character::c open(unit=10,file='file.dat') do i=1,huge(1) read(10,*,iostat=badness) write(*,*)i,badness if (badness/=0) exit enddo write(*,*)i end delays the nonzero iostat return with 4.3.0: $ gfortran --version GNU Fortran (GCC) 4.3.0 20071221 (experimental) Copyright (C) 2007 Free Software Foundation, Inc. GNU Fortran comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of GNU Fortran under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING $ gfortran -o aa aa.f90 $ ./aa 1 0 2 0 3 0 4 0 5 -1 5 That is, the forth read completes apparently successfully, even though we've read all three lines previously. 4.2.2 does what's expected: $ gfortran --version GNU Fortran (GCC) 4.2.2 Copyright (C) 2007 Free Software Foundation, Inc. GNU Fortran comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of GNU Fortran under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING $ gfortran -o aa aa.f90 $ ./aa 1 0 2 0 3 0 4 -1 4 If the read statement reads into something [ie line 7 of aa.f90 is changed to read(10,*,iostat=badness)c] then iostat returns -1 on the forth read with 4.3.0, as expected. (For those that insist on looking over their shoulder, ifort 10.1 and pgf90 7.0 return badness as -1 on the forth call, like gfortran used to.) -- Summary: IO error delayed Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: terry at chem dot gu dot se GCC host triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34676