This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]