@@ -43,7 +43,7 @@ PROTOTYPE ERROR_CLASS type_create_struct(COUNT count,
43
43
DATATYPE_ARRAY array_of_types ,
44
44
DATATYPE_OUT newtype )
45
45
{
46
- int i , rc ;
46
+ int i , rc , icount = ( int ) count ;
47
47
int * iarray_of_blocklengths = NULL ;
48
48
MPI_Aint * iarray_of_displacements = NULL ;
49
49
@@ -77,6 +77,12 @@ PROTOTYPE ERROR_CLASS type_create_struct(COUNT count,
77
77
FUNC_NAME );
78
78
}
79
79
}
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
80
86
}
81
87
82
88
#if OMPI_BIGCOUNT_SRC
@@ -97,7 +103,7 @@ PROTOTYPE ERROR_CLASS type_create_struct(COUNT count,
97
103
iarray_of_blocklengths = (int * )array_of_blocklengths ;
98
104
iarray_of_displacements = (MPI_Aint * )array_of_displacements ;
99
105
#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 ,
101
107
array_of_types , newtype );
102
108
if ( rc != MPI_SUCCESS ) {
103
109
ompi_datatype_destroy ( newtype );
@@ -110,10 +116,10 @@ PROTOTYPE ERROR_CLASS type_create_struct(COUNT count,
110
116
}
111
117
112
118
{
113
- const int * a_i [2 ] = {(int * )& count , iarray_of_blocklengths };
119
+ const int * a_i [2 ] = {(int * )& icount , iarray_of_blocklengths };
114
120
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 );
117
123
}
118
124
#if OMPI_BIGCOUNT_SRC
119
125
free (iarray_of_blocklengths );
0 commit comments