summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2019-11-24 22:14:59 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2019-11-24 22:14:59 +0000
commit73af0c7b3ac036802db97377422e8a8a750a56cc (patch)
tree743a8c4630626b7b2f49c2bd5ad523adf2c83550 /libgfortran
parent859174c82493971bd1e408231e24a7724953042f (diff)
re PR libfortran/92100 (Formatted stream IO irreproducible read with binary data in file)
2019-11-24 Jerry DeLisle <jvdelisle@gcc.ngu.org> PR fortran/92100 io/transfer.c (data_transfer_init_worker): Use fbuf_reset instead of fbuf_flush before the seek. Note that fbuf_reset calls fbuf_flush and adjusts fbuf pointers. From-SVN: r278660
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog7
-rw-r--r--libgfortran/io/transfer.c5
2 files changed, 10 insertions, 2 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 46b96f25f16..91768c0a00f 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,10 @@
+2019-11-24 Jerry DeLisle <jvdelisle@gcc.ngu.org>
+
+ PR fortran/92100
+ io/transfer.c (data_transfer_init_worker): Use fbuf_reset
+ instead of fbuf_flush before the seek. Note that fbuf_reset
+ calls fbuf_flush and adjusts fbuf pointers.
+
2019-11-23 Thomas Koenig <tkoenig@gcc.gnu.org>
Harald Anlauf <anlauf@gmx.de>
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index 89f0abe9938..43b22bf5f8d 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -3309,8 +3309,9 @@ data_transfer_init_worker (st_parameter_dt *dtp, int read_flag)
if (dtp->pos != dtp->u.p.current_unit->strm_pos)
{
- fbuf_flush (dtp->u.p.current_unit, dtp->u.p.mode);
- if (sseek (dtp->u.p.current_unit->s, dtp->pos - 1, SEEK_SET) < 0)
+ fbuf_reset (dtp->u.p.current_unit);
+ if (sseek (dtp->u.p.current_unit->s, dtp->pos - 1,
+ SEEK_SET) < 0)
{
generate_error (&dtp->common, LIBERROR_OS, NULL);
return;