Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit ea3f71a

Browse files
committed
Merge pull request #915 from ggouaillardet/topic/v2.x/missing_resize
Fix the missing resize of the returned type for
2 parents ffa07d9 + 4c7091a commit ea3f71a

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)