Skip to content

Commit 8e4faed

Browse files
jsquyresawlauria
authored andcommitted
grequest.c: only assign status.MPI_ERROR if we invoke free
Per extensive discussion, and as a followup to a671700 and 64b7ae0, only assign the status.MPI_ERROR value if we actually invoked a grequest free function (the current code paths allow a NULL value for the grequest free function, so it's possible that we won't invoke one). Signed-off-by: Jeff Squyres <jsquyres@cisco.com> (cherry picked from commit 354804c)
1 parent 81eab56 commit 8e4faed

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

ompi/request/grequest.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,24 +122,23 @@ static void ompi_grequest_construct(ompi_grequest_t* greq)
122122
*/
123123
static void ompi_grequest_destruct(ompi_grequest_t* greq)
124124
{
125-
int rc = 0;
126-
MPI_Fint ierr;
127-
128125
if (greq->greq_free.c_free != NULL) {
126+
/* We were already putting query_fn()'s return value into
127+
* status.MPI_ERROR but for MPI_{Wait,Test}*. If there's a
128+
* free callback to invoke, the standard says to use the
129+
* return value from free_fn() callback, too.
130+
*/
129131
if (greq->greq_funcs_are_c) {
130-
rc = greq->greq_free.c_free(greq->greq_state);
132+
greq->greq_base.req_status.MPI_ERROR =
133+
greq->greq_free.c_free(greq->greq_state);
131134
} else {
135+
MPI_Fint ierr;
132136
greq->greq_free.f_free((MPI_Aint*)greq->greq_state, &ierr);
133-
rc = OMPI_FINT_2_INT(ierr);
137+
greq->greq_base.req_status.MPI_ERROR =
138+
OMPI_FINT_2_INT(ierr);
134139
}
135140
}
136141

137-
/* We were already putting query_fn()'s return value into
138-
* status.MPI_ERROR but for MPI_{Wait,Test}* the standard
139-
* says use the free_fn() callback too.
140-
*/
141-
greq->greq_base.req_status.MPI_ERROR = rc;
142-
143142
OMPI_REQUEST_FINI(&greq->greq_base);
144143
}
145144

0 commit comments

Comments
 (0)