Formatted read with T format advances input file when a short record is encountered
Kraner, Luke (ES & CSO)
luke.kraner@ngc.com
Tue Oct 25 02:40:00 GMT 2016
I think I have encountered a minor bug in gfortran formatted input. The attached sample program tformat.f reads the file empty.inp with the statements:
READ(5,1010 ) IDXBLK, LMAX, LMIN
1010 FORMAT(8X,I4,T51,2I5)
If a record less than 12 characters long is encountered, the program advances the input file by one additional record. This violates section 9.4.4.4.2 of J3/97-007R2 which states that unless PAD='NO' is specified, the processor should supply blanks if the format requires more characters from the record than the record contains.
Luke Kraner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tformat.f
Type: application/octet-stream
Size: 1961 bytes
Desc: tformat.f
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20161025/54f56a9a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: blanks.inp
Type: application/octet-stream
Size: 270 bytes
Desc: blanks.inp
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20161025/54f56a9a/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: empty.inp
Type: application/octet-stream
Size: 258 bytes
Desc: empty.inp
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20161025/54f56a9a/attachment-0002.obj>
More information about the Fortran
mailing list