https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107031
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org Status|NEW |WAITING --- Comment #2 from kargl at gcc dot gnu.org --- gfortran's current behavior is correct. 12.3.4.4 File position after data transfer In all other cases, the file is positioned after the record just read or written and that record becomes the preceding record. 12.8.3 ENDFILE statement Execution of an ENDFILE statement for a file connected for sequential access writes an endfile record as the next record of the file. After reading '5', the file is position at the record that contains '6'. So, ENDIFLE writes the endfile record after the record with '6'.