diff --git a/ompi/datatype/dt_unpack.c b/ompi/datatype/dt_unpack.c index 53b57d43b2..4f0279d078 100644 --- a/ompi/datatype/dt_unpack.c +++ b/ompi/datatype/dt_unpack.c @@ -765,7 +765,12 @@ int32_t ompi_ddt_copy_content_same_ddt( const ompi_datatype_t* datatype, int32_t */ if( (datatype->flags & DT_FLAG_CONTIGUOUS) == DT_FLAG_CONTIGUOUS ) { long extent = (datatype->ub - datatype->lb); - if( (long)datatype->size == (datatype->true_ub - datatype->true_lb) ) { /* all contiguous */ + /* Now that we know the datatype is contiguous, we should move the 2 pointers + * source and destination to the correct displacement. + */ + pDestBuf += datatype->lb; + pSrcBuf += datatype->lb; + if( (long)datatype->size == extent ) { /* all contiguous == no gaps around */ int total_length = datatype->size * count; lastLength = 128 * 1024; if( lastLength > total_length ) lastLength = total_length;