summaryrefslogtreecommitdiffstats
path: root/libgfortran
diff options
context:
space:
mode:
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2008-03-28 22:13:17 +0000
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2008-03-28 22:13:17 +0000
commit65cccc979c1b98af699cd493de42416c3e455230 (patch)
tree1879a1c6f152773ff9b1ee3b67a6ce9462c387ca /libgfortran
parent18861bdedbc3018014fb66e6725342fce80436f0 (diff)
downloadppe42-gcc-65cccc979c1b98af699cd493de42416c3e455230.tar.gz
ppe42-gcc-65cccc979c1b98af699cd493de42416c3e455230.zip
2008-03-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/35699 * io/transfer.c (write_buf): Don't pad the record, just return if the data is NULL. (next_record_w): If there are bytes left in the record for unformatted direct I/O, pad out the record with zero bytes. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@133699 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog7
-rw-r--r--libgfortran/io/transfer.c14
2 files changed, 15 insertions, 6 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 57ec570681c..9e10c90b7e4 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,10 @@
+2008-03-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libfortran/35699
+ * io/transfer.c (write_buf): Don't pad the record, just return if the
+ data is NULL. (next_record_w): If there are bytes left in the record
+ for unformatted direct I/O, pad out the record with zero bytes.
+
2008-03-28 Tobias Burnus <burnus@net-b.de>
PR fortran/35721
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index 5ccc95823a8..dc80fc33f9e 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -639,12 +639,7 @@ write_buf (st_parameter_dt *dtp, void *buf, size_t nbytes)
}
if (buf == NULL && nbytes == 0)
- {
- char *p;
- p = write_block (dtp, dtp->u.p.current_unit->recl);
- memset (p, 0, dtp->u.p.current_unit->recl);
- return SUCCESS;
- }
+ return SUCCESS;
if (swrite (dtp->u.p.current_unit->s, buf, &nbytes) != 0)
{
@@ -2493,6 +2488,13 @@ next_record_w (st_parameter_dt *dtp, int done)
break;
case UNFORMATTED_DIRECT:
+ if (dtp->u.p.current_unit->bytes_left > 0)
+ {
+ length = (int) dtp->u.p.current_unit->bytes_left;
+ p = salloc_w (dtp->u.p.current_unit->s, &length);
+ memset (p, 0, length);
+ }
+
if (sfree (dtp->u.p.current_unit->s) == FAILURE)
goto io_error;
break;
OpenPOWER on IntegriCloud