Skip to content

Commit 385c791

Browse files
authored
Merge pull request #11834 from dalcinl/bugfix/type-dup-errors
datatype: Fix MPI_Type_dup() to propagate errors from inner calls
2 parents 2d024ce + 0c2fe12 commit 385c791

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

ompi/mpi/c/type_dup.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ static const char FUNC_NAME[] = "MPI_Type_dup";
4141
int MPI_Type_dup (MPI_Datatype type,
4242
MPI_Datatype *newtype)
4343
{
44+
int ret;
45+
4446
MEMCHECKER(
4547
memchecker_datatype(type);
4648
);
@@ -54,10 +56,9 @@ int MPI_Type_dup (MPI_Datatype type,
5456
}
5557
}
5658

57-
if (OMPI_SUCCESS != ompi_datatype_duplicate( type, newtype)) {
59+
if (OMPI_SUCCESS != (ret = ompi_datatype_duplicate( type, newtype))) {
5860
ompi_datatype_destroy( newtype );
59-
OMPI_ERRHANDLER_RETURN (MPI_ERR_INTERN, MPI_COMM_WORLD,
60-
MPI_ERR_INTERN, FUNC_NAME );
61+
OMPI_ERRHANDLER_NOHANDLE_RETURN( ret, ret, FUNC_NAME );
6162
}
6263

6364
ompi_datatype_set_args( *newtype, 0, NULL, 0, NULL, 1, &type, MPI_COMBINER_DUP );
@@ -69,13 +70,12 @@ int MPI_Type_dup (MPI_Datatype type,
6970
copy attributes. Really. */
7071
if (NULL != type->d_keyhash) {
7172
ompi_attr_hash_init(&(*newtype)->d_keyhash);
72-
if (OMPI_SUCCESS != ompi_attr_copy_all(TYPE_ATTR,
73-
type, *newtype,
74-
type->d_keyhash,
75-
(*newtype)->d_keyhash)) {
73+
if (OMPI_SUCCESS != (ret = ompi_attr_copy_all(TYPE_ATTR,
74+
type, *newtype,
75+
type->d_keyhash,
76+
(*newtype)->d_keyhash))) {
7677
ompi_datatype_destroy(newtype);
77-
OMPI_ERRHANDLER_NOHANDLE_RETURN( MPI_ERR_INTERN,
78-
MPI_ERR_INTERN, FUNC_NAME );
78+
OMPI_ERRHANDLER_NOHANDLE_RETURN( ret, ret, FUNC_NAME );
7979
}
8080
}
8181

0 commit comments

Comments
 (0)