diff --git a/ompi/datatype/dt_create_struct.c b/ompi/datatype/dt_create_struct.c index 2a25832c5a..cf7c727208 100644 --- a/ompi/datatype/dt_create_struct.c +++ b/ompi/datatype/dt_create_struct.c @@ -30,6 +30,7 @@ int32_t ompi_ddt_create_struct( int count, const int* pBlockLength, const long* if( 0 == count ) { *newType = ompi_ddt_create( disp ); + ompi_ddt_add( *newType, &ompi_mpi_datatype_null, 0, 0, 0); return OMPI_SUCCESS; } diff --git a/ompi/mpi/c/type_create_struct.c b/ompi/mpi/c/type_create_struct.c index 744dceab95..e420990eb5 100644 --- a/ompi/mpi/c/type_create_struct.c +++ b/ompi/mpi/c/type_create_struct.c @@ -45,9 +45,9 @@ int MPI_Type_create_struct(int count, if( count < 0 ) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COUNT, FUNC_NAME); - } else if(NULL == array_of_blocklengths || - NULL == array_of_displacements || - NULL == array_of_types) { + } else if( (count > 0) && (NULL == array_of_blocklengths || + NULL == array_of_displacements || + NULL == array_of_types) ) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME); } else if (NULL == newtype) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TYPE, FUNC_NAME);