From dff6accec63ab9415829103e480340888acaaab5 Mon Sep 17 00:00:00 2001 From: KAWASHIMA Takahiro Date: Wed, 15 Jun 2016 11:24:22 +0900 Subject: [PATCH] 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 open-mpi/ompi@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. --- ompi/datatype/ompi_datatype_args.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ompi/datatype/ompi_datatype_args.c b/ompi/datatype/ompi_datatype_args.c index 8c1af6c29ef..6fdd5167f19 100644 --- a/ompi/datatype/ompi_datatype_args.c +++ b/ompi/datatype/ompi_datatype_args.c @@ -764,7 +764,7 @@ static ompi_datatype_t* __ompi_datatype_create_from_args( int32_t* i, MPI_Aint* { 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]], &i[3 + 3 * i[0]], &i[3 + 4 * i[0]]}; - ompi_datatype_set_args( datatype, 4 * i[0] + 4,a_i, 0, NULL, 1, d, MPI_COMBINER_DARRAY); + ompi_datatype_set_args( datatype, 4 * i[2] + 4, a_i, 0, NULL, 1, d, MPI_COMBINER_DARRAY); } break; /******************************************************************/