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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123403
138bc75d-0d04-0410-961f-
82ee72b054a4
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.
/* 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);
{ 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. */
u->current_record = 0;
u->last_record = 0;
-
- test_endfile (u); /* We might be at the end. */
break;
case POSITION_APPEND:
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;
break;
}
-
- if (dtp->u.p.current_unit->flags.access == ACCESS_SEQUENTIAL
- && !dtp->u.p.namelist_mode)
- test_endfile (dtp->u.p.current_unit);
}
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: