diff options
author | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2007-04-01 17:32:20 +0000 |
---|---|---|
committer | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2007-04-01 17:32:20 +0000 |
commit | 08f9246a4574b9882c67bc64fabc69817142948f (patch) | |
tree | 33215bd612d3c257ba2f81ab28d1449710cbb577 | |
parent | 201c811d49e228c5e88f1e794f05d145b50e9128 (diff) | |
download | gcc-08f9246a4574b9882c67bc64fabc69817142948f.zip gcc-08f9246a4574b9882c67bc64fabc69817142948f.tar.gz gcc-08f9246a4574b9882c67bc64fabc69817142948f.tar.bz2 |
re PR libfortran/31052 ([4.2 only] Bad IOSTAT values when readings NAMELISTs past EOF)
2007-04-01 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/31052
* io/open.c (test_endfile): Delete this function.
(edit_modes): Delete call to test_endfile.
(new_unit): Likewise.
* io/io.h: Delete prototype for test_endfile.
* io/transfer.c (next_record_r): Remove use of test_endfile.
(st_read): Add test for end file condition and adjust status.
From-SVN: r123403
-rw-r--r-- | libgfortran/ChangeLog | 10 | ||||
-rw-r--r-- | libgfortran/io/io.h | 3 | ||||
-rw-r--r-- | libgfortran/io/open.c | 22 | ||||
-rw-r--r-- | libgfortran/io/transfer.c | 7 |
4 files changed, 13 insertions, 29 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 761e5b9..d360b6c 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,5 +1,15 @@ 2007-04-01 Jerry DeLisle <jvdelisle@gcc.gnu.org> + PR libgfortran/31052 + * io/open.c (test_endfile): Delete this function. + (edit_modes): Delete call to test_endfile. + (new_unit): Likewise. + * io/io.h: Delete prototype for test_endfile. + * io/transfer.c (next_record_r): Remove use of test_endfile. + (st_read): Add test for end file condition and adjust status. + +2007-04-01 Jerry DeLisle <jvdelisle@gcc.gnu.org> + PR libgfortran/31366 * io/transfer.c (read_block_direct): Do not generate error when reading past EOF on a short record that is less than the RECL= specified. diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h index ef1a287..df00669 100644 --- a/libgfortran/io/io.h +++ b/libgfortran/io/io.h @@ -695,9 +695,6 @@ internal_proto(unlock_unit); /* open.c */ -extern void test_endfile (gfc_unit *); -internal_proto(test_endfile); - extern gfc_unit *new_unit (st_parameter_open *, gfc_unit *, unit_flags *); internal_proto(new_unit); diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c index 44ff69d..742610a 100644 --- a/libgfortran/io/open.c +++ b/libgfortran/io/open.c @@ -109,19 +109,6 @@ static const st_option convert_opt[] = { NULL, 0} }; -/* Given a unit, test to see if the file is positioned at the terminal - point, and if so, change state from NO_ENDFILE flag to AT_ENDFILE. - This prevents us from changing the state from AFTER_ENDFILE to - AT_ENDFILE. */ - -void -test_endfile (gfc_unit * u) -{ - if (u->endfile == NO_ENDFILE && file_length (u->s) == file_position (u->s)) - u->endfile = AT_ENDFILE; -} - - /* Change the modes of a file, those that are allowed * to be changed. */ @@ -208,8 +195,6 @@ edit_modes (st_parameter_open *opp, gfc_unit * u, unit_flags * flags) u->current_record = 0; u->last_record = 0; - - test_endfile (u); /* We might be at the end. */ break; case POSITION_APPEND: @@ -487,13 +472,6 @@ new_unit (st_parameter_open *opp, gfc_unit *u, unit_flags * flags) memmove (u->file, opp->file, opp->file_len); u->file_len = opp->file_len; - /* Curiously, the standard requires that the - position specifier be ignored for new files so a newly connected - file starts out at the initial point. We still need to figure - out if the file is at the end or not. */ - - test_endfile (u); - if (flags->status == STATUS_SCRATCH && opp->file != NULL) free_mem (opp->file); return u; diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 3c6deb4..65d83ef 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -2226,10 +2226,6 @@ next_record_r (st_parameter_dt *dtp) break; } - - if (dtp->u.p.current_unit->flags.access == ACCESS_SEQUENTIAL - && !dtp->u.p.namelist_mode) - test_endfile (dtp->u.p.current_unit); } @@ -2702,6 +2698,9 @@ st_read (st_parameter_dt *dtp) switch (dtp->u.p.current_unit->endfile) { case NO_ENDFILE: + if (file_length (dtp->u.p.current_unit->s) + == file_position (dtp->u.p.current_unit->s)) + dtp->u.p.current_unit->endfile = AT_ENDFILE; break; case AT_ENDFILE: |