aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/read.c
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2010-03-18 02:38:17 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2010-03-18 02:38:17 +0000
commit59011a60c01403fec67e08bc6b94bb44da920482 (patch)
tree7c1839131a6afe8a4689fb882f4a40ba696bb7b8 /libgfortran/io/read.c
parent5408fbe892f610330f2d06f1cbdae515c1656443 (diff)
downloadgcc-59011a60c01403fec67e08bc6b94bb44da920482.zip
gcc-59011a60c01403fec67e08bc6b94bb44da920482.tar.gz
gcc-59011a60c01403fec67e08bc6b94bb44da920482.tar.bz2
re PR fortran/43265 (No EOF condition if reading with '(x)' from an empty file)
2010-03-17 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/43265 * io/io.h: Delete prototype for read_sf, making it static. * io/read.c (read_x): Modify to call hit_eof if PAD="no". * io/transfer.c (read_sf_internal): New static function extracted from read_sf for use on internal units only. Handle empty string case. (read_sf): New factoring of this function, make it static. Add special conditions for EOF based on ADVANCE="no", PAD="no", and whether any bytes have been previously read from the record. (read_block_form): Modify to call read_sf or read_sf_internal. (next_record_r): Add a done flag similar to next_record_w. Call hit_eof if internal array unit next record returns finished, meaning an EOF was found and not done, ie not the last record expected. For external units call hit_eof if item_count is 1 or there are no pending spaces. (next_record): Update call to next_record_r. From-SVN: r157527
Diffstat (limited to 'libgfortran/io/read.c')
-rw-r--r--libgfortran/io/read.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libgfortran/io/read.c b/libgfortran/io/read.c
index a4c4a58..078c6e2 100644
--- a/libgfortran/io/read.c
+++ b/libgfortran/io/read.c
@@ -1047,11 +1047,22 @@ read_x (st_parameter_dt *dtp, int n)
}
p = fbuf_read (dtp->u.p.current_unit, &length);
- if (p == NULL || (length == 0 && dtp->u.p.item_count == 1))
+ if (p == NULL)
{
hit_eof (dtp);
return;
}
+
+ if (length == 0 && dtp->u.p.item_count == 1)
+ {
+ if (dtp->u.p.current_unit->pad_status == PAD_NO)
+ {
+ hit_eof (dtp);
+ return;
+ }
+ else
+ return;
+ }
n = 0;
while (n < length)