Skip to content

Commit bba0112

Browse files
committed
MPI_Type_size_c should not return MPI_UNDEFINED
Signed-off-by: Joseph Schuchart <[email protected]>
1 parent 53e5fba commit bba0112

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ompi/mpi/c/type_size.c.in

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ PROTOTYPE ERROR_CLASS type_size(DATATYPE type, COUNT_OUT size)
5151

5252
opal_datatype_type_size ( &type->super, &type_size);
5353

54-
*size = (type_size > (size_t) INT_MAX) ? MPI_UNDEFINED : (int) type_size;
54+
if (sizeof(*size) == sizeof(int) && type_size > (size_t) INT_MAX) {
55+
*size = MPI_UNDEFINED;
56+
} else {
57+
*size = (MPI_Count) type_size;
58+
}
5559

5660
return MPI_SUCCESS;
5761
}

0 commit comments

Comments
 (0)