@@ -43,7 +43,7 @@ PROTOTYPE ERROR_CLASS type_create_struct(COUNT count,
4343 DATATYPE_ARRAY array_of_types ,
4444 DATATYPE_OUT newtype )
4545{
46- int i , rc ;
46+ int i , rc , icount = ( int ) count ;
4747 int * iarray_of_blocklengths = NULL ;
4848 MPI_Aint * iarray_of_displacements = NULL ;
4949
@@ -77,6 +77,12 @@ PROTOTYPE ERROR_CLASS type_create_struct(COUNT count,
7777 FUNC_NAME );
7878 }
7979 }
80+ #if OMPI_BIGCOUNT_SRC
81+ OMPI_CHECK_MPI_COUNT_INT_CONVERSION_OVERFLOW (rc , count );
82+ if (OMPI_SUCCESS != rc ) {
83+ return OMPI_ERRHANDLER_NOHANDLE_INVOKE (rc , FUNC_NAME );
84+ }
85+ #endif
8086 }
8187
8288#if OMPI_BIGCOUNT_SRC
@@ -97,7 +103,7 @@ PROTOTYPE ERROR_CLASS type_create_struct(COUNT count,
97103 iarray_of_blocklengths = (int * )array_of_blocklengths ;
98104 iarray_of_displacements = (MPI_Aint * )array_of_displacements ;
99105#endif
100- rc = ompi_datatype_create_struct ( count , iarray_of_blocklengths , iarray_of_displacements ,
106+ rc = ompi_datatype_create_struct ( icount , iarray_of_blocklengths , iarray_of_displacements ,
101107 array_of_types , newtype );
102108 if ( rc != MPI_SUCCESS ) {
103109 ompi_datatype_destroy ( newtype );
@@ -110,10 +116,10 @@ PROTOTYPE ERROR_CLASS type_create_struct(COUNT count,
110116 }
111117
112118 {
113- const int * a_i [2 ] = {(int * )& count , iarray_of_blocklengths };
119+ const int * a_i [2 ] = {(int * )& icount , iarray_of_blocklengths };
114120
115- ompi_datatype_set_args ( * newtype , count + 1 , a_i , count , iarray_of_displacements ,
116- count , array_of_types , MPI_COMBINER_STRUCT );
121+ ompi_datatype_set_args ( * newtype , icount + 1 , a_i , icount , iarray_of_displacements ,
122+ icount , array_of_types , MPI_COMBINER_STRUCT );
117123 }
118124#if OMPI_BIGCOUNT_SRC
119125 free (iarray_of_blocklengths );
0 commit comments