diff --git a/src/mpi/c/irecv.c b/src/mpi/c/irecv.c index 8ff117c839..75894833f2 100644 --- a/src/mpi/c/irecv.c +++ b/src/mpi/c/irecv.c @@ -34,7 +34,7 @@ int MPI_Irecv(void *buf, int count, MPI_Datatype type, int source, rc = MPI_ERR_COUNT; } else if (type == MPI_DATATYPE_NULL) { rc = MPI_ERR_TYPE; - } else if (tag < 0 || tag > MPI_TAG_UB_VALUE) { + } else if (((tag < 0) && (tag != MPI_ANY_TAG)) || (tag > MPI_TAG_UB_VALUE)) { rc = MPI_ERR_TAG; } else if (ompi_comm_invalid(comm)) { rc = MPI_ERR_COMM; diff --git a/src/mpi/c/recv.c b/src/mpi/c/recv.c index 5090e749ac..13c4392e76 100644 --- a/src/mpi/c/recv.c +++ b/src/mpi/c/recv.c @@ -40,7 +40,7 @@ int MPI_Recv(void *buf, int count, MPI_Datatype type, int source, rc = MPI_ERR_COUNT; } else if (type == MPI_DATATYPE_NULL) { rc = MPI_ERR_TYPE; - } else if (tag < 0 || tag > MPI_TAG_UB_VALUE) { + } else if (((tag < 0) && (tag != MPI_ANY_TAG)) || (tag > MPI_TAG_UB_VALUE)) { rc = MPI_ERR_TAG; } else if (ompi_comm_invalid(comm)) { rc = MPI_ERR_COMM; diff --git a/src/mpi/c/recv_init.c b/src/mpi/c/recv_init.c index 2f06c350ff..629591116a 100644 --- a/src/mpi/c/recv_init.c +++ b/src/mpi/c/recv_init.c @@ -34,7 +34,7 @@ int MPI_Recv_init(void *buf, int count, MPI_Datatype type, int source, rc = MPI_ERR_COUNT; } else if (type == MPI_DATATYPE_NULL) { rc = MPI_ERR_TYPE; - } else if (tag < 0 || tag > MPI_TAG_UB_VALUE) { + } else if (((tag < 0) && (tag != MPI_ANY_TAG)) || (tag > MPI_TAG_UB_VALUE)) { rc = MPI_ERR_TAG; } else if (ompi_comm_invalid(comm)) { rc = MPI_ERR_COMM; diff --git a/src/mpi/c/sendrecv.c b/src/mpi/c/sendrecv.c index e163102e8d..2efef544a2 100644 --- a/src/mpi/c/sendrecv.c +++ b/src/mpi/c/sendrecv.c @@ -46,7 +46,7 @@ int MPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype recvtype, rc = MPI_ERR_TYPE; } else if (source != MPI_PROC_NULL && source != MPI_ANY_SOURCE && ompi_comm_peer_invalid(comm, source)) { rc = MPI_ERR_RANK; - } else if (recvtag < MPI_ANY_TAG || recvtag > MPI_TAG_UB_VALUE) { + } else if (((recvtag < 0) && (recvtag != MPI_ANY_TAG)) || (recvtag > MPI_TAG_UB_VALUE)) { rc = MPI_ERR_TAG; } OMPI_ERRHANDLER_CHECK(rc, comm, rc, "MPI_Sendrecv");