[patch, fortran] PR80741 [Regression 7/8] DTIO wrong code causes incorrect behaviour of namelist READ
Jerry DeLisle
jvdelisle@charter.net
Wed May 17 05:34:00 GMT 2017
Hi all,
When I first looked at this I thought the minor front end bobble was the
problem. That turns out to be unrelated but needed to be fixed in trans-io.c
The actual problem was that when I moved the last_char to the unit structure,
needed for DTIO, the value saved there persists across I/O operations so in the
case of the PR the REWIND was was working but the EOF character from the
preceding read was passed on.
I conservatively have reset the last_char in several places out of concern for
missing a code path on this.
Regression tested on x86_64. New test case attached.
OK for trunk and then back port to 7 in about a week?
Regards,
Jerry
2017-05-16 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/80741
* trans-io.c (transfer_namelist_element): Change check from
NULL_TREE to null_pointer_node.
2017-05-16 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/80741
* transfer.c (finalize_transfer): Reset last_char to 'empty'.
* file_pos.c (formatted_backspace): Likewise.
(st_endfile): Likewise.
(st_rewind): Likewise.
(st_flush): Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr80741.diff
Type: text/x-patch
Size: 2136 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20170517/d20f183f/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: read_4.f90
Type: text/x-fortran
Size: 713 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20170517/d20f183f/attachment-0001.bin>
More information about the Fortran
mailing list