[PATCH, FIX] PR25264 write to internal unit from the string itself gives wrong result.
Jerry DeLisle
jvdelisle@verizon.net
Sun Dec 11 07:58:00 GMT 2005
:addpatch fortran:
The attached patch fixes the PR by eliminating code which emptied the string
when the internal unit was opened. Then when the string was accessed to write
into itself, there was nothing left but blanks.
It took a lot of trial and error to get the logic on setting the max_pos
variable correctly. Each type of IO: files, internal units, and internal unit
arrays, have different needs. And if its not just right, they clobber each
other, manifested in many regressions.
Regression tested, NIST tested.
OK for main TRUNK and 4.1?
2005-12-11 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/25264
* io/unit.c (get_unit): Delete code that cleared the string when the
unit was opened, which is too soon.
* io/transfer.c (formatted_transfer_scalar): Cleanup lines too long.
(next_record_w) Pass done flag in. Change logic for setting max_pos.
Add code to clear string as needed after it is passed for transfer.
Regards,
Jerry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nextpad.diff
Type: text/x-patch
Size: 3750 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20051211/f857e4eb/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: write_padding.f90
Type: application/x-extension-f90
Size: 386 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20051211/f857e4eb/attachment-0001.bin>
More information about the Gcc-patches
mailing list