[Patch, libgfortran, 4.5] PR25561, 37754: New low level I/O library
Janne Blomqvist
blomqvist.janne@gmail.com
Sun Jan 11 16:34:00 GMT 2009
Dominique Dhumieres wrote:
> Now the bad news: I see two regressions on my own tests:
I have now fixed these two issues; the attached patch is to be applied
on top of my original patch.
> (1) the following test aborts:
>
> character(len=20) :: b
> ! write something no advance
> open(10,FILE="fort.10",POSITION="REWIND")
> write(10, '(a,t1,a)',advance='no') 'XXXXXX', 'ABC'
> close(10)
> ! append some data
> open(10,FILE="fort.10",POSITION="APPEND")
> write(10, '(a)') 'DEF'
> close(10)
> ! check what is in the first record
> open(10,FILE="fort.10",POSITION="REWIND")
> read(10,'(a)') b
> IF (b.NE."ABCXXX") CALL ABORT()
> END
This was due to incorrectly resetting the format buffer when truncating
the file in write mode. This lost the bytes left in the record due to
advance='no'.
This bug also happened only on the second run of the test, since only in
that case was the endfile flag set to NO_ENDFILE, and the truncation
occurred (in transfer.c:st_write_done).
> (2) countlines.f does not work correctly on file containing the ascii
> character 255,
fbuf_getc() must cast the return value to unsigned char, otherwise the
caller thinks it hit EOF, and hence countlines.f showed an extra line.
Once again, thanks Dominique for testing the patch and reporting the issues!
--
Janne Blomqvist
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr25561-part2-8.1.diff
Type: text/x-patch
Size: 2097 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20090111/5be50115/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20090111/5be50115/attachment.sig>
More information about the Fortran
mailing list