http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52860
Bug #: 52860 Summary: I/O: gfortran rejects writing after hitting END= Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: bur...@gcc.gnu.org Reported by Christian Convey at http://gcc.gnu.org/ml/fortran/2012-03/msg00138.html Note: I have not checked the standard whether the following program is valid, I just want to make sure that the email does not get lost. Please also answer the original reporter. The following program reads from an empty file (created through the open statement) - it immediately hits an END - and then tries to write to that file. That succeeds with: g77, g95, gfortran <= 4.4, pgf90, ifort It fails with: gfortran >= 4.5, openf95, pathf95, crayftn with the message: Fortran runtime error: Sequential READ or WRITE not allowed after EOF marker, possibly use REWIND or BACKSPACE Please check whether that's indeed the proper error. (If so, should we add some legacy support?) PROGRAM MYTEST OPEN( UNIT=3, FILE='FOO', STATUS='UNKNOWN', 1 FORM='FORMATTED', ACCESS='SEQUENTIAL', IOSTAT=IOS ) write (*,*) 'reading' READ ( UNIT=3, FMT=*, END=10 ) BFR write (*,*) 'Done readin (no END)' GO TO 20 ! 10 REWIND( UNIT=3 ) 10 write (*,*) 'Hit END - writing' WRITE( UNIT=3, FMT='(A16)' ) 'BATCH MODE = OFF' write (*,*) 'Done writing' 20 write (*,*) 'Really done - closing' CLOSE( UNIT=3 ) END PROGRAM