[Bug libfortran/14904] New: [gfortran] INQUIRE returns incorrect LASTREC on multiple writes to DIRECT, FORMATTED units.

bdavis9659 at comcast dot net gcc-bugzilla@gcc.gnu.org
Sat Apr 10 03:02:00 GMT 2004


>From NIST test FM912.FOR.

When more than one record is written to a direct access formatted unit with one
write statement, inquire should increment LASTREC to reflect the number of
records written.  Currently, it assumes one write = one record written, which is
wrong.

Small example :

       OPEN(UNIT=10,ACCESS='DIRECT',FORM='FORMATTED',RECL=120)
 100   FORMAT(I4)
       WRITE(UNIT=10,REC=1,FMT=100)1
       INQUIRE(UNIT=10,NEXTREC=J)
       PRINT*,J
 200   FORMAT(I4,/,I4)
       WRITE(UNIT=10,REC=2,FMT=200)2,3
       INQUIRE(UNIT=10,NEXTREC=J)
       PRINT*,J
       END

$ gfc inquire.f
$ ./a.out
           2
           3
          ^^^ 
         should be 4

$ g77 inquire.f
$ ./a.out
 2
 4


$ gfortran --version
GNU Fortran 95 (GCC 3.5-tree-ssa 20040410 (merged 20040331))

-- 
           Summary: [gfortran]  INQUIRE returns incorrect LASTREC on
                    multiple writes to DIRECT, FORMATTED units.
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bdavis9659 at comcast dot net
                CC: gcc-bugs at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list