From ec1bd1554ca0f197e215e9142fc3d211b6167b85 Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Sat, 21 Nov 2009 02:44:01 +0000 Subject: [PATCH] re PR fortran/42090 (I/O: Problems when reading partial records in formatted direct access files) 2009-11-20 Jerry DeLisle PR libgfortran/42090 Backport from trunk. * io/transfer.c (skip_record): Set bytes_left_subrecord to zero after skipping the remaining bytes in the record. (next_record_r): Call skip_record with the number of bytes_left to be skipped. From-SVN: r154397 --- libgfortran/ChangeLog | 9 +++++++++ libgfortran/io/transfer.c | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 2f3accde31bd..0a4ecaa8fb74 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,12 @@ +2009-11-20 Jerry DeLisle + + PR libgfortran/42090 + Backport from trunk. + * io/transfer.c (skip_record): Set bytes_left_subrecord to zero after + skipping the remaining bytes in the record. + (next_record_r): Call skip_record with the number of bytes_left to be + skipped. + 2009-08-04 Release Manager * GCC 4.3.4 released. diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index a93c9b8dcd57..d5c9d4e7edff 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -2186,6 +2186,8 @@ skip_record (st_parameter_dt *dtp, size_t bytes) only I/O errors. */ if (sseek (dtp->u.p.current_unit->s, new) == FAILURE) generate_error (&dtp->common, LIBERROR_OS, NULL); + + dtp->u.p.current_unit->bytes_left_subrecord = 0; } else { /* Seek by reading data. */ @@ -2258,7 +2260,7 @@ next_record_r (st_parameter_dt *dtp) case FORMATTED_DIRECT: case UNFORMATTED_DIRECT: - skip_record (dtp, 0); + skip_record (dtp, dtp->u.p.current_unit->bytes_left); break; case FORMATTED_STREAM: -- 2.47.2