This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[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
- From: "tkoenig at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Mar 2007 19:04:58 -0000
- Subject: [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
- References: <bug-31366-14284@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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