diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index d5e178ed9f310e947150b40b50a0372cb3219f70..009b044f51df7871d44325b41466703da069026b 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2006-01-17 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libgfortran/25697 + * io/transfer.c (us_read): Detect end of file condition from previous + operations and bail out (no need to pre-position). + 2006-01-17 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/25631 diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 729883586f87d7350ca84ca55170eb290f328f46..b5b8df45e9cff2f1ce9b15599b2b5a64d010ebf6 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Contributed by Andy Vaught Namelist transfer functions contributed by Paul Thomas @@ -1219,11 +1219,17 @@ us_read (st_parameter_dt *dtp) int n; gfc_offset i; + if (dtp->u.p.current_unit->endfile == AT_ENDFILE) + return; + n = sizeof (gfc_offset); p = salloc_r (dtp->u.p.current_unit->s, &n); if (n == 0) - return; /* end of file */ + { + dtp->u.p.current_unit->endfile = AT_ENDFILE; + return; /* end of file */ + } if (p == NULL || n != sizeof (gfc_offset)) {