Skip to content

Commit 12dad8b

Browse files
bosilcaggouaillardet
authored andcommitted
Fix the missing resize of the returned type for
the subarray and darray types. Thanks Keith Bennett and Dan Garmann for reporting this issue Fixes #1191
1 parent 6e6fd14 commit 12dad8b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

ompi/datatype/ompi_datatype_create_darray.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ int32_t ompi_datatype_create_darray(int size,
270270
*newtype = ompi_datatype_create(lastType->super.desc.used);
271271
rc = ompi_datatype_add(*newtype, lastType, 1, displs[0], displs[1]);
272272
ompi_datatype_destroy(&lastType);
273+
opal_datatype_resize( &(*newtype)->super, 0, displs[1] );
273274
/* need to destroy the old type even in error condition, so
274275
don't check return code from above until after cleanup. */
275276
if (MPI_SUCCESS != rc) newtype = NULL;

ompi/datatype/ompi_datatype_create_subarray.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
1414
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
1515
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
16-
* Copyright (c) 2014 Research Organization for Information Science
16+
* Copyright (c) 2014-2015 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
1818
* $COPYRIGHT$
1919
*
@@ -36,7 +36,7 @@ int32_t ompi_datatype_create_subarray(int ndims,
3636
const ompi_datatype_t* oldtype,
3737
ompi_datatype_t** newtype)
3838
{
39-
MPI_Datatype last_type;
39+
ompi_datatype_t *last_type;
4040
int32_t i, step, end_loop;
4141
MPI_Aint size, displ, extent;
4242

@@ -102,6 +102,7 @@ int32_t ompi_datatype_create_subarray(int ndims,
102102
*newtype = ompi_datatype_create( last_type->super.desc.used );
103103
ompi_datatype_add( *newtype, last_type, 1, displ * extent, size * extent);
104104
ompi_datatype_destroy( &last_type );
105+
opal_datatype_resize( &(*newtype)->super, 0, size * extent );
105106

106107
return OMPI_SUCCESS;
107108
}

0 commit comments

Comments
 (0)