Skip to content

Commit eeb6dfc

Browse files
committed
bug fix: sbuf index, array of size nsend
1 parent c845ecb commit eeb6dfc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/drivers/ncchunkio/ncchkioi_put_var.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,8 @@ int ncchkioi_put_var_cb_proc (NC_chk *ncchkp,
505505
if (nsend > 0) {
506506
sbuf[0] = sbufp[0] = (char *)NCI_Malloc (bsize);
507507
CHK_PTR (sbuf[0])
508-
for (i = 1; i < nsend; i++) { sbuf[i] = sbufp[i] = sbuf[0] + ssize[i]; }
508+
for (i = 1; i < nsend; i++)
509+
sbuf[i] = sbufp[i] = sbuf[i-1] + ssize[i-1];
509510
}
510511

511512
// Pack requests
@@ -540,7 +541,8 @@ int ncchkioi_put_var_cb_proc (NC_chk *ncchkp,
540541

541542
// Data
542543
packoff = 0;
543-
CHK_ERR_PACK (buf, 1, ptype, sbufp[j], ssize[j], &packoff, MPI_COMM_SELF);
544+
int outsize = ssize[j] - sizeof(int) * (varp->ndim * 2 + 1);
545+
CHK_ERR_PACK (buf, 1, ptype, sbufp[j], outsize, &packoff, MPI_COMM_SELF);
544546
sbufp[j] += packoff;
545547
MPI_Type_free (&ptype);
546548
}

0 commit comments

Comments
 (0)