[patch, fortran] PR80741 [Regression 7/8] DTIO wrong code causes incorrect behaviour of namelist READ

Paul Richard Thomas paul.richard.thomas@gmail.com
Wed May 17 18:44:00 GMT 2017


Hi Jerry,

OK for trunk and for 7-branch after a delay.

Cheers and thanks

Paul

On 17 May 2017 at 06:34, Jerry DeLisle <jvdelisle@charter.net> wrote:
> 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.



-- 
"If you can't explain it simply, you don't understand it well enough"
- Albert Einstein



More information about the Gcc-patches mailing list