Skip to content

Commit d077e5b

Browse files
committed
mpi/[send]recv.c: set memcheck for single-receive functions
Similar to other functions (e.g., MPI_Wait[any]), ensure that if running under Valgrind or some other memory checker, don't raise an error because the status.MPI_ERROR field is undefined. Signed-off-by: Jeff Squyres <jeff@squyres.com>
1 parent ee747c6 commit d077e5b

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

ompi/mpi/c/recv.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* Copyright (c) 2010-2012 Oak Ridge National Labs. All rights reserved.
1313
* Copyright (c) 2015 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
15+
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
1516
* $COPYRIGHT$
1617
*
1718
* Additional copyrights may follow
@@ -90,6 +91,12 @@ int MPI_Recv(void *buf, int count, MPI_Datatype type, int source,
9091
if (MPI_PROC_NULL == source) {
9192
if (MPI_STATUS_IGNORE != status) {
9293
OMPI_COPY_STATUS(status, ompi_request_empty.req_status, false);
94+
/*
95+
* Per MPI-1, the MPI_ERROR field is not defined for single-completion calls
96+
*/
97+
MEMCHECKER(
98+
opal_memchecker_base_mem_undefined(&status->MPI_ERROR, sizeof(int));
99+
);
93100
}
94101
return MPI_SUCCESS;
95102
}

ompi/mpi/c/sendrecv.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* Copyright (c) 2015 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
1818
* Copyright (c) 2021 Nanook Consulting. All rights reserved.
19+
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
1920
* $COPYRIGHT$
2021
*
2122
* Additional copyrights may follow
@@ -121,6 +122,12 @@ int MPI_Sendrecv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
121122
} else {
122123
if (MPI_STATUS_IGNORE != status) {
123124
OMPI_COPY_STATUS(status, ompi_request_empty.req_status, false);
125+
/*
126+
* Per MPI-1, the MPI_ERROR field is not defined for single-completion calls
127+
*/
128+
MEMCHECKER(
129+
opal_memchecker_base_mem_undefined(&status->MPI_ERROR, sizeof(int));
130+
);
124131
}
125132
rc = MPI_SUCCESS;
126133
}

0 commit comments

Comments
 (0)