diff options
author | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-09-28 19:38:03 +0000 |
---|---|---|
committer | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-09-28 19:38:03 +0000 |
commit | 5feeeb06d30b5505ab1fa6b9e04cc7a453204977 (patch) | |
tree | b19be4e6c667ffa7820db3e2b637f97ed4fdf573 /libgfortran | |
parent | 2a2770c6502b2b227c525c8f5c491f66dd69dd21 (diff) | |
download | gcc-5feeeb06d30b5505ab1fa6b9e04cc7a453204977.tar.gz |
2016-09-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/77707
io/transfer.c (next_record): Flush before calculating next_record.
Correctly calculate.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240592 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 6 | ||||
-rw-r--r-- | libgfortran/io/transfer.c | 7 |
2 files changed, 10 insertions, 3 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index f312a066c18..c58ad5d0ca0 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2016-09-28 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libgfortran/77707 + io/transfer.c (next_record): Flush before calculating next_record. + Correctly calculate. + 2016-09-23 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/48298 diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 6009c123d71..902c02011ae 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -3720,6 +3720,8 @@ next_record (st_parameter_dt *dtp, int done) else next_record_w (dtp, done); + fbuf_flush (dtp->u.p.current_unit, dtp->u.p.mode); + if (!is_stream_io (dtp)) { /* Since we have changed the position, set it to unspecified so @@ -3733,8 +3735,8 @@ next_record (st_parameter_dt *dtp, int done) fp = stell (dtp->u.p.current_unit->s); /* Calculate next record, rounding up partial records. */ dtp->u.p.current_unit->last_record = - (fp + dtp->u.p.current_unit->recl - 1) / - dtp->u.p.current_unit->recl; + (fp + dtp->u.p.current_unit->recl) / + dtp->u.p.current_unit->recl - 1; } else dtp->u.p.current_unit->last_record++; @@ -3743,7 +3745,6 @@ next_record (st_parameter_dt *dtp, int done) if (!done) pre_position (dtp); - fbuf_flush (dtp->u.p.current_unit, dtp->u.p.mode); smarkeor (dtp->u.p.current_unit->s); } |