[patch, libgfortran] Bug 78123 - Short reads with T edit descriptor not padding correctly

Jerry DeLisle jvdelisle@charter.net
Sun Oct 30 20:21:00 GMT 2016

See patch below which is very simple. We were handling the case where we tabbed 
left of current position in the record by clearing the seen_eor flag. We were 
not handling the case where we tab toward the right and so are still at eor.

New test case attached. Regression tested on x86-64-linux.

OK to commit?

This is a regression relative to g77. Its simple enough I think it should go to 
5 and 6 as well.



2016-10-30  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/79123
	* io/transfer.c (formatted_transfer_scalar_read): Clear seen_eor
	only if we have tabbed to left of current position.

diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index b8eb5ed..5830362 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -1579,7 +1579,8 @@ formatted_transfer_scalar_read (st_parameter_dt *dtp, bt 
type, void *p, int kind
                dtp->u.p.current_unit->bytes_left -= dtp->u.p.sf_seen_eor;
                dtp->u.p.skips -= dtp->u.p.sf_seen_eor;
               bytes_used = pos;
-             dtp->u.p.sf_seen_eor = 0;
+             if (dtp->u.p.pending_spaces == 0)
+               dtp->u.p.sf_seen_eor = 0;
           if (dtp->u.p.skips < 0)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fmt_t_9.f
Type: text/x-fortran
Size: 1476 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20161030/cd19d8a1/attachment.bin>

More information about the Gcc-patches mailing list