2006-01-17 Jerry DeLisle <jvdelisle@gcc.gnu.org>
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 18 Jan 2006 06:21:28 +0000 (06:21 +0000)
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 18 Jan 2006 06:21:28 +0000 (06:21 +0000)
PR libgfortran/25697
* io/transfer.c (us_read): Detect end of file condition from previous
operations and bail out (no need to pre-position).

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109870 138bc75d-0d04-0410-961f-82ee72b054a4

libgfortran/ChangeLog
libgfortran/io/transfer.c

index d5e178e..009b044 100644 (file)
@@ -1,5 +1,11 @@
 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
        * io/transfer.c (formatted_transfer_scalar): Adjust pending_spaces and
        skips so that TL works correctly when no bytes_used yet.  
index 7298835..b5b8df4 100644 (file)
@@ -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))
     {