From 6c1400dd58f277badc66633f5d26b7c9ba589a11 Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Tue, 30 Mar 2010 03:22:28 +0000 Subject: [PATCH] re PR fortran/43265 (No EOF condition if reading with '(x)' from an empty file) 2010-03-29 Jerry DeLisle PR libfortran/43265 * io/transfer.c (next_record_r): Only call hit_eof for specific conditions when an EOF is encountered. From-SVN: r157810 --- libgfortran/ChangeLog | 6 ++++++ libgfortran/io/transfer.c | 11 ++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 4958831010e8..2385b64483c2 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2010-03-29 Jerry DeLisle + + PR libfortran/43265 + * io/transfer.c (next_record_r): Only call hit_eof for specific + conditions when an EOF is encountered. + 2010-03-29 Tobias Burnus PR fortran/43551 diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 7f6750d21563..93c0e03c25d5 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -2848,9 +2848,14 @@ next_record_r (st_parameter_dt *dtp, int done) { if (errno != 0) generate_error (&dtp->common, LIBERROR_OS, NULL); - else if (dtp->u.p.item_count == 1 - || dtp->u.p.pending_spaces == 0) - hit_eof (dtp); + else + { + if (is_stream_io (dtp) + || dtp->u.p.current_unit->pad_status == PAD_NO + || dtp->u.p.current_unit->bytes_left + == dtp->u.p.current_unit->recl) + hit_eof (dtp); + } break; }