[Bug libfortran/24796] New: end-of-record error when writing

chjacob at web dot de gcc-bugzilla@gcc.gnu.org
Fri Nov 11 14:39:00 GMT 2005


I found a problem with writing an unformatted file after
reading from it and encountering an end-of-file during
this reading. In that case it is not possible to write 
to the file anymore.

I do not know what the standard says about this, but
ifort accepts this.

christoph@note-jacob:~/chemie/sources/gfortran-bugs/write > cat write.f90

program bla
  implicit none
  integer, parameter :: iunit=30
  character(len=8) :: b

  OPEN(IUNIT,FILE="BLA",STATUS='NEW',FORM='UNFORMATTED')

  read (IUNIT, ERR=10, END=10) B
  10 continue

  write (iunit) "bla"
  CLOSE(IUNIT)
end program bla

christoph@note-jacob:~/write > gfortran-4.0.2 write.f90
christoph@note-jacob:~/write > ./a.out
At line 12 of file write.f90
Fortran runtime error: End of record


-- 
           Summary: end-of-record error when writing
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: chjacob at web dot de
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24796



More information about the Gcc-bugs mailing list