Skip to content

Commit dff6acc

Browse files
committed
ompi/datatype: Fix args of DARRAY
According to MPI-3.1 P.122, `ni` for `MPI_COMBINER_DARRAY` should be `4*ndims+4`, not `4*size+4`. This bug may cause SEGV if `size` is smaller than `ndims` when the darray is used for one-sided communication (pt2pt OSC). This bug was introduced in 79b13f36 (when darray became a first class citizen and the `a_i` index of darray was shifted by 2). The corresponding `MPI_Type_create_darray()` function sets a right value so we don't need to update the function.
1 parent b7e937f commit dff6acc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ompi/datatype/ompi_datatype_args.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ static ompi_datatype_t* __ompi_datatype_create_from_args( int32_t* i, MPI_Aint*
764764
{
765765
const int* a_i[8] = {&i[0], &i[1], &i[2], &i[3 + 0 * i[0]], &i[3 + 1 * i[0]], &i[3 + 2 * i[0]],
766766
&i[3 + 3 * i[0]], &i[3 + 4 * i[0]]};
767-
ompi_datatype_set_args( datatype, 4 * i[0] + 4,a_i, 0, NULL, 1, d, MPI_COMBINER_DARRAY);
767+
ompi_datatype_set_args( datatype, 4 * i[2] + 4, a_i, 0, NULL, 1, d, MPI_COMBINER_DARRAY);
768768
}
769769
break;
770770
/******************************************************************/

0 commit comments

Comments
 (0)