re PR libfortran/27575 (gfortran - does not generate error when trying to read too...
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Wed, 17 May 2006 00:36:53 +0000 (00:36 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Wed, 17 May 2006 00:36:53 +0000 (00:36 +0000)
2006-05-16  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR libgfortran/27575
* io/transfer.c (read_block):  Add check for end file condition.
(read_block_direct): Add check for end file condition.

From-SVN: r113837

libgfortran/ChangeLog
libgfortran/io/transfer.c

index cb8c0fd1c282af48fd32bc8e9dc905dd6b1e6ba1..5b53e2b2541f8bdbff7451e3d551317fb0eec827 100644 (file)
@@ -1,3 +1,9 @@
+2006-05-16  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR libgfortran/27575
+       * io/transfer.c (read_block):  Add check for end file condition.
+       (read_block_direct): Add check for end file condition.
+
 2006-05-05  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
 
        PR libfortran/26985
index 43af8fbc938772bb976ac48e76e415b2b99cb750..054217daa798f3f9dbc78cc7d3227e1b70ae28b3 100644 (file)
@@ -272,6 +272,13 @@ read_block (st_parameter_dt *dtp, int *length)
            }
        }
 
+      if (dtp->u.p.current_unit->bytes_left == 0)
+       {
+         dtp->u.p.current_unit->endfile = AT_ENDFILE;
+         generate_error (&dtp->common, ERROR_END, NULL);
+         return;
+       }
+
       *length = dtp->u.p.current_unit->bytes_left;
     }
 
@@ -328,6 +335,13 @@ read_block_direct (st_parameter_dt *dtp, void *buf, size_t *nbytes)
            }
        }
 
+      if (dtp->u.p.current_unit->bytes_left == 0)
+       {
+         dtp->u.p.current_unit->endfile = AT_ENDFILE;
+         generate_error (&dtp->common, ERROR_END, NULL);
+         return;
+       }
+
       *nbytes = dtp->u.p.current_unit->bytes_left;
     }