diff --git a/ompi/mpi/c/ireduce.c b/ompi/mpi/c/ireduce.c index be552250fce..4026025c9d1 100644 --- a/ompi/mpi/c/ireduce.c +++ b/ompi/mpi/c/ireduce.c @@ -100,7 +100,8 @@ int MPI_Ireduce(const void *sendbuf, void *recvbuf, int count, free(msg); return ret; } else if ((ompi_comm_rank(comm) != root && MPI_IN_PLACE == sendbuf) || - (ompi_comm_rank(comm) == root && ((MPI_IN_PLACE == recvbuf) || (sendbuf == recvbuf)))) { + (ompi_comm_rank(comm) == root && ((MPI_IN_PLACE == recvbuf) || + ((sendbuf == recvbuf) && (0 != count))))) { err = MPI_ERR_ARG; } else { OMPI_CHECK_DATATYPE_FOR_SEND(err, datatype, count); diff --git a/ompi/mpi/c/reduce.c b/ompi/mpi/c/reduce.c index 7dcae11148b..47378f86086 100644 --- a/ompi/mpi/c/reduce.c +++ b/ompi/mpi/c/reduce.c @@ -98,7 +98,8 @@ int MPI_Reduce(const void *sendbuf, void *recvbuf, int count, free(msg); return ret; } else if ((ompi_comm_rank(comm) != root && MPI_IN_PLACE == sendbuf) || - (ompi_comm_rank(comm) == root && ((MPI_IN_PLACE == recvbuf) || (sendbuf == recvbuf)))) { + (ompi_comm_rank(comm) == root && ((MPI_IN_PLACE == recvbuf) || + ((sendbuf == recvbuf) && (0 != count))))) { err = MPI_ERR_ARG; } else { OMPI_CHECK_DATATYPE_FOR_SEND(err, datatype, count);