+2008-01-24 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libfortran/34876
+ * io/transfer.c (write_buf): Handle case of zero sized array.
+ (transfer_array): Set data pointer to NULL and size to zero. Then
+ make a data transfer and return.
+
2008-01-24 David Edelsohn <edelsohn@gnu.org>
* configure: Regenerate.
return FAILURE;
}
+ 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;
+ }
+
if (swrite (dtp->u.p.current_unit->s, buf, &nbytes) != 0)
{
generate_error (&dtp->common, LIBERROR_OS, NULL);
dtp->u.p.current_unit->bytes_left -= (gfc_offset) nbytes;
return SUCCESS;
-
}
/* Unformatted sequential. */
extent[n] = desc->dim[n].ubound + 1 - desc->dim[n].lbound;
/* If the extent of even one dimension is zero, then the entire
- array section contains zero elements, so we return. */
+ array section contains zero elements, so we return after writing
+ a zero array record. */
if (extent[n] <= 0)
- return;
+ {
+ data = NULL;
+ tsize = 0;
+ dtp->u.p.transfer (dtp, iotype, data, kind, size, tsize);
+ return;
+ }
}
stride0 = stride[0];