summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-01 15:23:48 +0000
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-01 15:23:48 +0000
commit68537e59a1acc8bf37656ad657e2a86303ecc765 (patch)
tree9a9f870b5335d52676fe3c2e37a924b54d23fe1e /libgfortran
parent34a438224e02552a93eb285271b9cf4179ac0faf (diff)
downloadgcc-68537e59a1acc8bf37656ad657e2a86303ecc765.tar.gz
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. 2007-04-01 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/31207 * io/unit.c (close_unit_1): If there are bytes previously written from ADVANCE="no", move to the end before closing. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123401 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog12
-rw-r--r--libgfortran/io/transfer.c1
-rw-r--r--libgfortran/io/unit.c24
3 files changed, 36 insertions, 1 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 6b8f4f89da2..761e5b9a4d2 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,15 @@
+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.
+
+2007-04-01 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libgfortran/31207
+ * io/unit.c (close_unit_1): If there are bytes previously written from
+ ADVANCE="no", move to the end before closing.
+
2007-03-31 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR libfortran/31335
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index 2555898e112..3c6deb4998c 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -411,7 +411,6 @@ read_block_direct (st_parameter_dt *dtp, void *buf, size_t *nbytes)
/* Short read, e.g. if we hit EOF. Apparently, we read
more than was written to the last record. */
*nbytes = to_read_record;
- generate_error (&dtp->common, ERROR_SHORT_RECORD, NULL);
return;
}
diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c
index 90e6d85f6da..2d2c7426cf6 100644
--- a/libgfortran/io/unit.c
+++ b/libgfortran/io/unit.c
@@ -590,6 +590,30 @@ close_unit_1 (gfc_unit *u, int locked)
{
int i, rc;
+ /* If there are previously written bytes from a write with ADVANCE="no"
+ Reposition the buffer before closing. */
+ if (u->saved_pos > 0)
+ {
+ char *p;
+
+ p = salloc_w (u->s, &u->saved_pos);
+
+ if (!(u->unit_number == options.stdout_unit
+ || u->unit_number == options.stderr_unit))
+ {
+ size_t len;
+
+ const char crlf[] = "\r\n";
+#ifdef HAVE_CRLF
+ len = 2;
+#else
+ len = 1;
+#endif
+ if (swrite (u->s, &crlf[2-len], &len) != 0)
+ os_error ("Close after ADVANCE_NO failed");
+ }
+ }
+
rc = (u->s == NULL) ? 0 : sclose (u->s) == FAILURE;
u->closed = 1;