The following program (also attached) reads to eof, backspace, reads (eof detected), backspace, and reads again. The last read gets the last line with gfortran 4.5 (tested: r148116) but eof with gfortran <= 4.4, g95, g77 and Sun f95.
>From reading comp.lang.fortran I know that EOF/BACKSPACE interaction can be problematic but I'd still hope this would work to be consistent with the other compilers. PROGRAM TEST IMPLICIT NONE CHARACTER(LEN=5) :: STR OPEN(2,FILE='fort.2',ACCESS='sequential') WRITE(2,'(A)')'HELLO' REWIND(2) DO READ(2,'(A)',END=1) STR PRINT *,STR ENDDO 1 BACKSPACE 2 !the file pointer is now at EOF READ(2,*,END=2) STR PRINT *,'error1: not at eof',str STOP 2 BACKSPACE 2 !the file pointer is now at EOF READ(2,'(A)',END=3) STR PRINT *,'error2: not at eof' STOP 3 PRINT *,'correct' END -- Summary: 4.5 regression: changed BACKSPACE behaviour at end of file. Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libfortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bartoldeman at users dot sourceforge dot net GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40334