[Bug fortran/31366] When the last record written to a direct access file is shorter than the record length of the file, gfortran truncates the record
tkoenig at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Mar 27 19:05:00 GMT 2007
------- Comment #2 from tkoenig at gcc dot gnu dot org 2007-03-27 20:04 -------
This is the same behavor that g77 had. Also, reading
back what we have written works for both gfortran and g77:
$ cat tst.f
PROGRAM MAIN
character*1 c
OPEN (76, FILE="test.txt",ACCESS="DIRECT",STATUS="NEW",RECL=10)
WRITE(76, REC=1) "1"
read (76, REC=1) c
print *,c
END
$ g77 tst.f
$ ./a.out
1
$ rm -f test.txt
$ gfortran tst.f
$ ./a.out
1
Offhand, I don't think this is wrong. The Fortran standard talks
about records, not about bytes in a file.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31366
More information about the Gcc-bugs
mailing list