From ef4b6203a44ed02b8005eb950fefe54be1427656 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Fri, 1 May 2015 17:08:15 +0900 Subject: [PATCH] Correctly unpack datatype. Alignment requirements were relaxed in open-mpi/ompi@33a3ace8740538069e4d96eabb518e987b69f82c so correctly handle this when unpacking a datatype. --- ompi/datatype/ompi_datatype_args.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ompi/datatype/ompi_datatype_args.c b/ompi/datatype/ompi_datatype_args.c index dcc231e29c..946cb1d3eb 100644 --- a/ompi/datatype/ompi_datatype_args.c +++ b/ompi/datatype/ompi_datatype_args.c @@ -577,8 +577,11 @@ static ompi_datatype_t* __ompi_datatype_create_from_packed_description( void** p number_of_datatype ); next_buffer += (4 * sizeof(int)); /* move after the header */ - /* The pointer should always be aligned on MPI_Aint, aka OPAL_PTRDIFF_TYPE */ - OMPI_DATATYPE_ALIGN_PTR(next_buffer, char*); + /* description of the displacements (if ANY !) should always be aligned + on MPI_Aint, aka OPAL_PTRDIFF_TYPE */ + if (number_of_disp > 0) { + OMPI_DATATYPE_ALIGN_PTR(next_buffer, char*); + } array_of_disp = (OPAL_PTRDIFF_TYPE*)next_buffer; next_buffer += number_of_disp * sizeof(OPAL_PTRDIFF_TYPE);