From c89e8c37120d33060211f2c5525128d9aebd223b Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 13 Sep 2005 19:07:13 +0000 Subject: [PATCH] Fixes for error checking -- properly ignore arguments as they should be This commit was SVN r7347. --- ompi/mpi/c/gather.c | 4 +++- ompi/mpi/c/gatherv.c | 2 +- ompi/mpi/c/scatter.c | 12 +++++++----- ompi/mpi/c/scatterv.c | 16 ++++++++++------ 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/ompi/mpi/c/gather.c b/ompi/mpi/c/gather.c index 7961272071..76c98c10d7 100644 --- a/ompi/mpi/c/gather.c +++ b/ompi/mpi/c/gather.c @@ -57,7 +57,9 @@ int MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype, return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ROOT, FUNC_NAME); } - OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcount); + if (MPI_IN_PLACE != sendbuf) { + OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcount); + } OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME); /* Errors for the root. Some of these could have been diff --git a/ompi/mpi/c/gatherv.c b/ompi/mpi/c/gatherv.c index 9fb478615d..b39a2f65cb 100644 --- a/ompi/mpi/c/gatherv.c +++ b/ompi/mpi/c/gatherv.c @@ -55,7 +55,7 @@ int MPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, if ((root >= ompi_comm_size(comm)) || (root < 0)) { err = MPI_ERR_ROOT; - } else { + } else if (MPI_IN_PLACE != sendbuf) { OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcount); } OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME); diff --git a/ompi/mpi/c/scatter.c b/ompi/mpi/c/scatter.c index f90973a6d0..2f187f5ef7 100644 --- a/ompi/mpi/c/scatter.c +++ b/ompi/mpi/c/scatter.c @@ -55,11 +55,13 @@ int MPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype, /* Errors for all ranks */ if ((root >= ompi_comm_size(comm)) || (root < 0)) { - err = MPI_ERR_ROOT; - } else if (recvcount < 0) { - err = MPI_ERR_COUNT; - } else if (MPI_DATATYPE_NULL == recvtype) { - err = MPI_ERR_TYPE; + err = MPI_ERR_ROOT; + } else if (MPI_IN_PLACE != recvbuf) { + if (recvcount < 0) { + err = MPI_ERR_COUNT; + } else if (MPI_DATATYPE_NULL == recvtype) { + err = MPI_ERR_TYPE; + } } /* Errors for the root. Some of these could have been diff --git a/ompi/mpi/c/scatterv.c b/ompi/mpi/c/scatterv.c index db0a34a60c..1efd76312e 100644 --- a/ompi/mpi/c/scatterv.c +++ b/ompi/mpi/c/scatterv.c @@ -57,12 +57,16 @@ int MPI_Scatterv(void *sendbuf, int *sendcounts, int *displs, return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ROOT, FUNC_NAME); } - if (recvcount < 0) { - return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_COUNT, FUNC_NAME); - } - - if (MPI_DATATYPE_NULL == recvtype) { - return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TYPE, FUNC_NAME); + if (MPI_IN_PLACE != recvbuf) { + if (recvcount < 0) { + return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_COUNT, + FUNC_NAME); + } + + if (MPI_DATATYPE_NULL == recvtype) { + return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TYPE, + FUNC_NAME); + } } /* Errors for the root. Some of these could have been