https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77707
Bug ID: 77707 Summary: [4.5-7.0 Regression] formatted direct access: nextrec off by one Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: manfred99 at gmx dot ch Target Milestone: --- program directaccess_formatted integer nextrec open(10, file='directaccess_formatted.dat', form='formatted', access='direct', recl=10*4) write(10,'(10i4)',rec=9) 1,2,3,4,5,6,7,8,9,10 inquire(unit=10,nextrec=nextrec) print*,"Next rec: ",nextrec close(10) end prints the following: 4.3: Next rec: 10 4.5-7.0: Next rec: 9 As I have no working gfortran 4.4 any more, I can't tell whether 4.4 is OK or not. nextrec is "last record read or written, plus one". In contrast, unformatted direct access is OK and prints "10". Possibly related bugs: Bug 14836, Bug 14904