diff --git a/ompi/request/req_wait.c b/ompi/request/req_wait.c index 141c10168b..5ea2adecb6 100644 --- a/ompi/request/req_wait.c +++ b/ompi/request/req_wait.c @@ -16,6 +16,8 @@ * Copyright (c) 2016 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2016 Mellanox Technologies. All rights reserved. + * Copyright (c) 2016 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -89,6 +91,11 @@ int ompi_request_default_wait_any(size_t count, ompi_request_t *request=NULL; ompi_wait_sync_t sync; + if (OPAL_UNLIKELY(0 == count)) { + *index = MPI_UNDEFINED; + return OMPI_SUCCESS; + } + WAIT_SYNC_INIT(&sync, 1); num_requests_null_inactive = 0; @@ -197,6 +204,10 @@ int ompi_request_default_wait_all( size_t count, int mpi_error = OMPI_SUCCESS; ompi_wait_sync_t sync; + if (OPAL_UNLIKELY(0 == count)) { + return OMPI_SUCCESS; + } + WAIT_SYNC_INIT(&sync, count); rptr = requests; for (i = 0; i < count; i++) { @@ -374,6 +385,11 @@ int ompi_request_default_wait_some(size_t count, ompi_wait_sync_t sync; size_t sync_sets = 0, sync_unsets = 0; + if (OPAL_UNLIKELY(0 == count)) { + *outcount = MPI_UNDEFINED; + return OMPI_SUCCESS; + } + WAIT_SYNC_INIT(&sync, 1); *outcount = 0;