[Bug fortran/44477] Sequential I/O with END FILE: File position should be at EoF

kargl at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sun Jun 20 16:41:00 GMT 2010



------- Comment #8 from kargl at gcc dot gnu dot org  2010-06-20 16:41 -------
(In reply to comment #7)
> The following occurs in the snapshot of June 19, but not in earlier snapshots:
> 
> mrichmon@msc545ux:~$ cat test.f90
> PROGRAM test
> END FILE 10
> END FILE 10
> END PROGRAM test
> mrichmon@msc545ux:~$ gfortran test.f90
> mrichmon@msc545ux:~$ ./a.out
> At line 3 of file test.f90 (unit = 10, file = 'fort.10')
> Fortran runtime error: Cannot perform ENDFILE on a file already positioned
> after the EOF marker
> 

Did you read the error message?  The code is invalid.  For the Fortran 95
standard:

   After execution of an ENDFILE statement, a BACKSPACE or REWIND
   statement shall be used to reposition the file prior to execution
   of any data transfer input/output statement or ENDFILE statement.


-- 


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



More information about the Gcc-bugs mailing list