From 3e2031e0e3309732b65bc591d6c931f96924b172 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Wed, 21 Mar 2007 11:10:42 +0000 Subject: [PATCH] Finally commit something that has been sitting around in one of my development trees since last year (had to wait for some intel tests to run yesterday, so I finally took the time to finish this work): * Improve MPI API argument checking by also checking for NULL values (especially helps when invalid Fortran MPI handles are passed, because the various MPI_*f2c functions are supposed to return an "invalid" MPI handle [meaning NULL] when this happens). So now OMPI will generate an MPI exception rather than a segv. * Removed a few redundant DATATYPE_NULL checks. * Also check for some other forms of "invalid" handles (e.g., already been freed, etc.) in some cases. We could probably be a bit more stringent in this regard if we really wanted to. * Change MPI_Get_processor_name to zero out the string up to MPI_MAX_PROCESSOR_NAME characters, because the MPI spec says that the string must be at least that long. We were already passing that length to gethostname(), anyway. This commit was SVN r14100. --- ompi/mpi/c/allgather.c | 3 ++- ompi/mpi/c/alltoall.c | 3 ++- ompi/mpi/c/alltoallv.c | 3 ++- ompi/mpi/c/alltoallw.c | 3 ++- ompi/mpi/c/attr_delete.c | 3 ++- ompi/mpi/c/attr_put.c | 3 ++- ompi/mpi/c/bsend.c | 3 ++- ompi/mpi/c/cart_coords.c | 3 ++- ompi/mpi/c/cart_create.c | 3 ++- ompi/mpi/c/cart_get.c | 3 ++- ompi/mpi/c/cart_map.c | 3 ++- ompi/mpi/c/cart_rank.c | 3 ++- ompi/mpi/c/cart_shift.c | 3 ++- ompi/mpi/c/cart_sub.c | 3 ++- ompi/mpi/c/comm_create.c | 4 ++-- ompi/mpi/c/comm_delete_attr.c | 3 ++- ompi/mpi/c/comm_get_errhandler.c | 4 ++-- ompi/mpi/c/comm_set_attr.c | 3 ++- ompi/mpi/c/gather.c | 6 +++--- ompi/mpi/c/gatherv.c | 6 +++--- ompi/mpi/c/get_processor_name.c | 10 ++++++++++ ompi/mpi/c/graph_create.c | 3 ++- ompi/mpi/c/graph_get.c | 3 ++- ompi/mpi/c/graph_map.c | 3 ++- ompi/mpi/c/graph_neighbors.c | 3 ++- ompi/mpi/c/graph_neighbors_count.c | 3 ++- ompi/mpi/c/graphdims_get.c | 3 ++- ompi/mpi/c/grequest_complete.c | 2 +- ompi/mpi/c/grequest_start.c | 2 +- ompi/mpi/c/group_compare.c | 4 ++++ ompi/mpi/c/group_difference.c | 4 +++- ompi/mpi/c/group_excl.c | 6 +++++- ompi/mpi/c/group_free.c | 4 +++- ompi/mpi/c/group_incl.c | 8 ++++++-- ompi/mpi/c/group_intersection.c | 4 +++- ompi/mpi/c/group_range_excl.c | 4 +++- ompi/mpi/c/group_range_incl.c | 4 +++- ompi/mpi/c/group_rank.c | 4 ++++ ompi/mpi/c/group_size.c | 4 ++++ ompi/mpi/c/group_union.c | 4 +++- ompi/mpi/c/ibsend.c | 3 +-- ompi/mpi/c/irecv.c | 3 +++ ompi/mpi/c/irsend.c | 6 ++++-- ompi/mpi/c/isend.c | 3 ++- ompi/mpi/c/issend.c | 2 -- ompi/mpi/c/pack.c | 5 +++-- ompi/mpi/c/pack_external.c | 3 ++- ompi/mpi/c/pack_external_size.c | 3 ++- ompi/mpi/c/pack_size.c | 5 +++-- ompi/mpi/c/put.c | 4 ++++ ompi/mpi/c/recv_init.c | 2 ++ ompi/mpi/c/reduce.c | 2 +- ompi/mpi/c/reduce_scatter.c | 3 ++- ompi/mpi/c/request_free.c | 3 ++- ompi/mpi/c/request_get_status.c | 5 ++++- ompi/mpi/c/rsend.c | 3 ++- ompi/mpi/c/rsend_init.c | 2 +- ompi/mpi/c/scan.c | 3 ++- ompi/mpi/c/scatter.c | 4 ++-- ompi/mpi/c/scatterv.c | 6 +++--- ompi/mpi/c/send_init.c | 2 -- ompi/mpi/c/ssend.c | 3 ++- ompi/mpi/c/ssend_init.c | 2 +- ompi/mpi/c/startall.c | 8 ++++---- ompi/mpi/c/testall.c | 9 +++++++-- ompi/mpi/c/testany.c | 7 +++++++ ompi/mpi/c/testsome.c | 8 +++++++- ompi/mpi/c/type_commit.c | 3 ++- ompi/mpi/c/type_contiguous.c | 3 ++- ompi/mpi/c/unpack.c | 3 ++- ompi/mpi/c/unpack_external.c | 3 ++- ompi/mpi/c/waitsome.c | 8 +++++++- 72 files changed, 195 insertions(+), 84 deletions(-) diff --git a/ompi/mpi/c/allgather.c b/ompi/mpi/c/allgather.c index a3eb06be68..f0e7995660 100644 --- a/ompi/mpi/c/allgather.c +++ b/ompi/mpi/c/allgather.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2007 Cisco, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -50,7 +51,7 @@ int MPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype, OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if (ompi_comm_invalid(comm)) { OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); - } else if (MPI_DATATYPE_NULL == recvtype) { + } else if (MPI_DATATYPE_NULL == recvtype || NULL == recvtype) { err = MPI_ERR_TYPE; } else if (recvcount < 0) { err = MPI_ERR_COUNT; diff --git a/ompi/mpi/c/alltoall.c b/ompi/mpi/c/alltoall.c index 38350fcd51..81aaf17285 100644 --- a/ompi/mpi/c/alltoall.c +++ b/ompi/mpi/c/alltoall.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2007 Cisco, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -51,7 +52,7 @@ int MPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype, if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); - } else if (MPI_DATATYPE_NULL == recvtype) { + } else if (MPI_DATATYPE_NULL == recvtype || NULL == recvtype) { err = MPI_ERR_TYPE; } else if (recvcount < 0) { err = MPI_ERR_COUNT; diff --git a/ompi/mpi/c/alltoallv.c b/ompi/mpi/c/alltoallv.c index c503f07a29..8c7bb91943 100644 --- a/ompi/mpi/c/alltoallv.c +++ b/ompi/mpi/c/alltoallv.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2007 Cisco, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -68,7 +69,7 @@ int MPI_Alltoallv(void *sendbuf, int *sendcounts, int *sdispls, for (i = 0; i < size; ++i) { if (recvcounts[i] < 0) { err = MPI_ERR_COUNT; - } else if (MPI_DATATYPE_NULL == recvtype) { + } else if (MPI_DATATYPE_NULL == recvtype || NULL == recvtype) { err = MPI_ERR_TYPE; } else { OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcounts[i]); diff --git a/ompi/mpi/c/alltoallw.c b/ompi/mpi/c/alltoallw.c index 81ea2c3faf..2761ee87b7 100644 --- a/ompi/mpi/c/alltoallw.c +++ b/ompi/mpi/c/alltoallw.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2007 Cisco, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -68,7 +69,7 @@ int MPI_Alltoallw(void *sendbuf, int *sendcounts, int *sdispls, for (i = 0; i < size; ++i) { if (recvcounts[i] < 0) { err = MPI_ERR_COUNT; - } else if (MPI_DATATYPE_NULL == recvtypes[i]) { + } else if (MPI_DATATYPE_NULL == recvtypes[i] || NULL == recvtypes[i]) { err = MPI_ERR_TYPE; } else { OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtypes[i], sendcounts[i]); diff --git a/ompi/mpi/c/attr_delete.c b/ompi/mpi/c/attr_delete.c index 67445b30dd..564f80f77e 100644 --- a/ompi/mpi/c/attr_delete.c +++ b/ompi/mpi/c/attr_delete.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -41,7 +42,7 @@ int MPI_Attr_delete(MPI_Comm comm, int keyval) if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (MPI_COMM_NULL == comm) { + if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } diff --git a/ompi/mpi/c/attr_put.c b/ompi/mpi/c/attr_put.c index b9dea09186..201323cc07 100644 --- a/ompi/mpi/c/attr_put.c +++ b/ompi/mpi/c/attr_put.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -40,7 +41,7 @@ int MPI_Attr_put(MPI_Comm comm, int keyval, void *attribute_val) if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (MPI_COMM_NULL == comm) { + if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } diff --git a/ompi/mpi/c/bsend.c b/ompi/mpi/c/bsend.c index 3c2b7360df..a763028526 100644 --- a/ompi/mpi/c/bsend.c +++ b/ompi/mpi/c/bsend.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -45,7 +46,7 @@ int MPI_Bsend(void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Co return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } else if (count < 0) { rc = MPI_ERR_COUNT; - } else if (type == MPI_DATATYPE_NULL) { + } else if (MPI_DATATYPE_NULL == type || NULL == type) { rc = MPI_ERR_TYPE; } else if (tag < 0 || tag > mca_pml.pml_max_tag) { rc = MPI_ERR_TAG; diff --git a/ompi/mpi/c/cart_coords.c b/ompi/mpi/c/cart_coords.c index f51f63ac93..fafb1c8e3c 100644 --- a/ompi/mpi/c/cart_coords.c +++ b/ompi/mpi/c/cart_coords.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -43,7 +44,7 @@ int MPI_Cart_coords(MPI_Comm comm, int rank, int maxdims, int *coords) /* check the arguments */ if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (MPI_COMM_NULL == comm) { + if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } diff --git a/ompi/mpi/c/cart_create.c b/ompi/mpi/c/cart_create.c index 2cd407bc6a..ece16cf224 100644 --- a/ompi/mpi/c/cart_create.c +++ b/ompi/mpi/c/cart_create.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -44,7 +45,7 @@ int MPI_Cart_create(MPI_Comm old_comm, int ndims, int *dims, /* check the arguments */ if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (MPI_COMM_NULL == old_comm) { + if (ompi_comm_invalid(old_comm)) { return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } diff --git a/ompi/mpi/c/cart_get.c b/ompi/mpi/c/cart_get.c index 820dde8123..aea12e465d 100644 --- a/ompi/mpi/c/cart_get.c +++ b/ompi/mpi/c/cart_get.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -44,7 +45,7 @@ int MPI_Cart_get(MPI_Comm comm, int maxdims, int *dims, /* check the arguments */ if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (MPI_COMM_NULL == comm || OMPI_COMM_IS_INTER(comm)) { + if (ompi_comm_invalid(comm) || OMPI_COMM_IS_INTER(comm)) { return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } diff --git a/ompi/mpi/c/cart_map.c b/ompi/mpi/c/cart_map.c index 5e6234f60e..6b1d83f6e6 100644 --- a/ompi/mpi/c/cart_map.c +++ b/ompi/mpi/c/cart_map.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -43,7 +44,7 @@ int MPI_Cart_map(MPI_Comm comm, int ndims, int *dims, /* check the arguments */ if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (MPI_COMM_NULL == comm) { + if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } diff --git a/ompi/mpi/c/cart_rank.c b/ompi/mpi/c/cart_rank.c index a8f1f77929..00fd1b2b3d 100644 --- a/ompi/mpi/c/cart_rank.c +++ b/ompi/mpi/c/cart_rank.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -42,7 +43,7 @@ int MPI_Cart_rank(MPI_Comm comm, int *coords, int *rank) /* check the arguments */ if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (MPI_COMM_NULL == comm) { + if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } diff --git a/ompi/mpi/c/cart_shift.c b/ompi/mpi/c/cart_shift.c index cf4da11006..2e3f859e0c 100644 --- a/ompi/mpi/c/cart_shift.c +++ b/ompi/mpi/c/cart_shift.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -43,7 +44,7 @@ int MPI_Cart_shift(MPI_Comm comm, int direction, int disp, /* check the arguments */ if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (MPI_COMM_NULL == comm) { + if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } diff --git a/ompi/mpi/c/cart_sub.c b/ompi/mpi/c/cart_sub.c index bf12405e6f..53e528da52 100644 --- a/ompi/mpi/c/cart_sub.c +++ b/ompi/mpi/c/cart_sub.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -42,7 +43,7 @@ int MPI_Cart_sub(MPI_Comm comm, int *remain_dims, MPI_Comm *new_comm) /* check the arguments */ if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (MPI_COMM_NULL == comm) { + if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } diff --git a/ompi/mpi/c/comm_create.c b/ompi/mpi/c/comm_create.c index 4c75a9786f..a55b6671aa 100644 --- a/ompi/mpi/c/comm_create.c +++ b/ompi/mpi/c/comm_create.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -45,7 +45,7 @@ int MPI_Comm_create(MPI_Comm comm, MPI_Group group, MPI_Comm *newcomm) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); - if ( MPI_GROUP_NULL == group ) + if ( MPI_GROUP_NULL == group || NULL == group ) return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_GROUP, FUNC_NAME); diff --git a/ompi/mpi/c/comm_delete_attr.c b/ompi/mpi/c/comm_delete_attr.c index 4c4598a0ec..4491c66b37 100644 --- a/ompi/mpi/c/comm_delete_attr.c +++ b/ompi/mpi/c/comm_delete_attr.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2007 Cisco, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -40,7 +41,7 @@ int MPI_Comm_delete_attr(MPI_Comm comm, int comm_keyval) if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (MPI_COMM_NULL == comm) { + if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } diff --git a/ompi/mpi/c/comm_get_errhandler.c b/ompi/mpi/c/comm_get_errhandler.c index 23e559bd87..9a55bc417a 100644 --- a/ompi/mpi/c/comm_get_errhandler.c +++ b/ompi/mpi/c/comm_get_errhandler.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2007 Cisco, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -40,8 +41,7 @@ int MPI_Comm_get_errhandler(MPI_Comm comm, MPI_Errhandler *errhandler) if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (NULL == comm || - MPI_COMM_NULL == comm) { + if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME); } else if (NULL == errhandler) { diff --git a/ompi/mpi/c/comm_set_attr.c b/ompi/mpi/c/comm_set_attr.c index ad4dd3793a..455368f1a2 100644 --- a/ompi/mpi/c/comm_set_attr.c +++ b/ompi/mpi/c/comm_set_attr.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2007 Cisco, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -40,7 +41,7 @@ int MPI_Comm_set_attr(MPI_Comm comm, int comm_keyval, void *attribute_val) if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (MPI_COMM_NULL == comm) { + if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } diff --git a/ompi/mpi/c/gather.c b/ompi/mpi/c/gather.c index 195d5a9428..6e0083d909 100644 --- a/ompi/mpi/c/gather.c +++ b/ompi/mpi/c/gather.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -74,7 +74,7 @@ int MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype, them out into individual tests. */ if (ompi_comm_rank(comm) == root) { - if (recvtype == MPI_DATATYPE_NULL) { + if (MPI_DATATYPE_NULL == recvtype || NULL == recvtype) { return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TYPE, FUNC_NAME); } @@ -108,7 +108,7 @@ int MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype, return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_COUNT, FUNC_NAME); } - if (MPI_DATATYPE_NULL == recvtype) { + if (MPI_DATATYPE_NULL == recvtype || NULL == recvtype) { return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TYPE, FUNC_NAME); } } diff --git a/ompi/mpi/c/gatherv.c b/ompi/mpi/c/gatherv.c index d77809272b..38f80433c8 100644 --- a/ompi/mpi/c/gatherv.c +++ b/ompi/mpi/c/gatherv.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -84,7 +84,7 @@ int MPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, for (i = 0; i < size; ++i) { if (recvcounts[i] < 0) { return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_COUNT, FUNC_NAME); - } else if (MPI_DATATYPE_NULL == recvtype) { + } else if (MPI_DATATYPE_NULL == recvtype || NULL == recvtype) { return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TYPE, FUNC_NAME); } } @@ -123,7 +123,7 @@ int MPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, for (i = 0; i < size; ++i) { if (recvcounts[i] < 0) { return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_COUNT, FUNC_NAME); - } else if (MPI_DATATYPE_NULL == recvtype) { + } else if (MPI_DATATYPE_NULL == recvtype || NULL == recvtype) { return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TYPE, FUNC_NAME); } } diff --git a/ompi/mpi/c/get_processor_name.c b/ompi/mpi/c/get_processor_name.c index ecc3c34d0d..0de14515f1 100644 --- a/ompi/mpi/c/get_processor_name.c +++ b/ompi/mpi/c/get_processor_name.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -57,6 +58,15 @@ int MPI_Get_processor_name(char *name, int *resultlen) /* A simple implementation of this function using gethostname*/ gethostname (tmp, MPI_MAX_PROCESSOR_NAME); len = (int)strlen (tmp); + /* Pre-clearing the resulting string is not strictly necessary, + but since MPI says that the buffer must be at least + MPI_MAX_PROCESSOR_NAME bytes long, it does seem social to zero + out past *resultlen. If nothing else, it makes the intel + Fortran MPI_GET_PROCESSOR_NAME tests print out a bit nicer + (because it prints out the whole string, not just the first + *resultlen characters, so it prints empty space rather than + garbage) */ + memset(name, ' ', MPI_MAX_PROCESSOR_NAME); strncpy ( name, tmp, len); if ( MPI_MAX_PROCESSOR_NAME > len ) { diff --git a/ompi/mpi/c/graph_create.c b/ompi/mpi/c/graph_create.c index cf49dec4e3..3fa5f277a3 100644 --- a/ompi/mpi/c/graph_create.c +++ b/ompi/mpi/c/graph_create.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2007 Cisco, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -45,7 +46,7 @@ int MPI_Graph_create(MPI_Comm old_comm, int nnodes, int *index, /* check the arguments */ if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (MPI_COMM_NULL == old_comm) { + if (ompi_comm_invalid(old_comm)) { return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } diff --git a/ompi/mpi/c/graph_get.c b/ompi/mpi/c/graph_get.c index c7776cb985..145d19991e 100644 --- a/ompi/mpi/c/graph_get.c +++ b/ompi/mpi/c/graph_get.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2007 Cisco, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -42,7 +43,7 @@ int MPI_Graph_get(MPI_Comm comm, int maxindex, int maxedges, /* check the arguments */ if (MPI_PARAM_CHECK) { - if (MPI_COMM_NULL == comm) { + if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } diff --git a/ompi/mpi/c/graph_map.c b/ompi/mpi/c/graph_map.c index 14319e328b..62b9d77c12 100644 --- a/ompi/mpi/c/graph_map.c +++ b/ompi/mpi/c/graph_map.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2007 Cisco, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -43,7 +44,7 @@ int MPI_Graph_map(MPI_Comm comm, int nnodes, int *index, int *edges, /* check the arguments */ if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (MPI_COMM_NULL == comm) { + if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } diff --git a/ompi/mpi/c/graph_neighbors.c b/ompi/mpi/c/graph_neighbors.c index 509546276c..8f296a2ce4 100644 --- a/ompi/mpi/c/graph_neighbors.c +++ b/ompi/mpi/c/graph_neighbors.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2007 Cisco, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -43,7 +44,7 @@ int MPI_Graph_neighbors(MPI_Comm comm, int rank, int maxneighbors, /* check the arguments */ if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (MPI_COMM_NULL == comm) { + if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } diff --git a/ompi/mpi/c/graph_neighbors_count.c b/ompi/mpi/c/graph_neighbors_count.c index 05e03b77e0..73ffac7f65 100644 --- a/ompi/mpi/c/graph_neighbors_count.c +++ b/ompi/mpi/c/graph_neighbors_count.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2007 Cisco, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -42,7 +43,7 @@ int MPI_Graph_neighbors_count(MPI_Comm comm, int rank, int *nneighbors) /* check the arguments */ if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (MPI_COMM_NULL == comm) { + if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } diff --git a/ompi/mpi/c/graphdims_get.c b/ompi/mpi/c/graphdims_get.c index cd6336e22b..1299e801cd 100644 --- a/ompi/mpi/c/graphdims_get.c +++ b/ompi/mpi/c/graphdims_get.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2007 Cisco, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -42,7 +43,7 @@ int MPI_Graphdims_get(MPI_Comm comm, int *nnodes, int *nedges) /* check the arguments */ if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (MPI_COMM_NULL == comm) { + if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } diff --git a/ompi/mpi/c/grequest_complete.c b/ompi/mpi/c/grequest_complete.c index 5c1592d0db..6792e7a637 100644 --- a/ompi/mpi/c/grequest_complete.c +++ b/ompi/mpi/c/grequest_complete.c @@ -41,7 +41,7 @@ int MPI_Grequest_complete(MPI_Request request) if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (request == MPI_REQUEST_NULL) { + if (MPI_REQUEST_NULL == request || NULL == request) { rc = MPI_ERR_REQUEST; } else if (OMPI_REQUEST_GEN != request->req_type) { rc = MPI_ERR_REQUEST; diff --git a/ompi/mpi/c/grequest_start.c b/ompi/mpi/c/grequest_start.c index beb644bd8c..43a2ba6da1 100644 --- a/ompi/mpi/c/grequest_start.c +++ b/ompi/mpi/c/grequest_start.c @@ -45,7 +45,7 @@ int MPI_Grequest_start(MPI_Grequest_query_function *query_fn, if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if (NULL == request) { - return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, + return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_REQUEST, FUNC_NAME); } } diff --git a/ompi/mpi/c/group_compare.c b/ompi/mpi/c/group_compare.c index fb5ae63e19..1ba1bc6c9f 100644 --- a/ompi/mpi/c/group_compare.c +++ b/ompi/mpi/c/group_compare.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -55,6 +56,9 @@ int MPI_Group_compare(MPI_Group group1, MPI_Group group2, int *result) { (NULL == group1) || (NULL==group2) ){ return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP, FUNC_NAME); + } else if (NULL == result) { + return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, + FUNC_NAME); } } diff --git a/ompi/mpi/c/group_difference.c b/ompi/mpi/c/group_difference.c index eddede2938..ce3b3f8fe7 100644 --- a/ompi/mpi/c/group_difference.c +++ b/ompi/mpi/c/group_difference.c @@ -10,6 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006 University of Houston. All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -47,7 +48,8 @@ int MPI_Group_difference(MPI_Group group1, MPI_Group group2, OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if( (MPI_GROUP_NULL == group1) || (MPI_GROUP_NULL == group2) || - (NULL == group1) || (NULL == group2) ) { + (NULL == group1) || (NULL == group2) || + (NULL == new_group) ) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP, FUNC_NAME); } diff --git a/ompi/mpi/c/group_excl.c b/ompi/mpi/c/group_excl.c index 252876beaa..a3fdc5ebb1 100644 --- a/ompi/mpi/c/group_excl.c +++ b/ompi/mpi/c/group_excl.c @@ -10,6 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006 University of Houston. All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -50,9 +51,12 @@ int MPI_Group_excl(MPI_Group group, int n, int *ranks, /* verify that group is valid group */ if ( (MPI_GROUP_NULL == group) || (NULL == group) || - (NULL == ranks) ) { + (NULL == new_group) ) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP, FUNC_NAME); + } else if (NULL == ranks) { + return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, + FUNC_NAME); } /* check that new group is no larger than old group */ diff --git a/ompi/mpi/c/group_free.c b/ompi/mpi/c/group_free.c index c5c8b68ca8..8ba297e858 100644 --- a/ompi/mpi/c/group_free.c +++ b/ompi/mpi/c/group_free.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -42,7 +43,8 @@ int MPI_Group_free(MPI_Group *group) if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if ((MPI_GROUP_NULL == *group) || (NULL == *group) ) { + if ((NULL == group) || + (MPI_GROUP_NULL == *group) || (NULL == *group) ) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP, FUNC_NAME); } diff --git a/ompi/mpi/c/group_incl.c b/ompi/mpi/c/group_incl.c index 2f38be8325..b7b120fe21 100644 --- a/ompi/mpi/c/group_incl.c +++ b/ompi/mpi/c/group_incl.c @@ -10,6 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006 University of Houston. All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -50,10 +51,13 @@ int MPI_Group_incl(MPI_Group group, int n, int *ranks, MPI_Group *new_group) OMPI_ERR_INIT_FINALIZE(FUNC_NAME); /* verify that group is valid group */ - if ( (MPI_GROUP_NULL == group) || ( NULL == group) - || NULL == ranks ) { + if ( (MPI_GROUP_NULL == group) || ( NULL == group) || + (NULL == new_group) ) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP, FUNC_NAME); + } else if (NULL == ranks) { + return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, + FUNC_NAME); } /* check that new group is no larger than old group */ diff --git a/ompi/mpi/c/group_intersection.c b/ompi/mpi/c/group_intersection.c index 60d39a1655..c3ae33eb8f 100644 --- a/ompi/mpi/c/group_intersection.c +++ b/ompi/mpi/c/group_intersection.c @@ -10,6 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006 University of Houston. All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -48,7 +49,8 @@ int MPI_Group_intersection(MPI_Group group1, MPI_Group group2, /* verify that groups are valid */ if ( (MPI_GROUP_NULL == group1) || (MPI_GROUP_NULL == group2) || - ( NULL == group1) || (NULL == group2) ) { + ( NULL == group1) || (NULL == group2) || + (NULL == new_group) ) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP, FUNC_NAME); } diff --git a/ompi/mpi/c/group_range_excl.c b/ompi/mpi/c/group_range_excl.c index 3d39b961ad..866279031e 100644 --- a/ompi/mpi/c/group_range_excl.c +++ b/ompi/mpi/c/group_range_excl.c @@ -10,6 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006 University of Houston. All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -46,7 +47,8 @@ int MPI_Group_range_excl(MPI_Group group, int n_triplets, int ranges[][3], /* can't act on NULL group */ if( MPI_PARAM_CHECK ) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if ( (MPI_GROUP_NULL == group) || (NULL == group) ) { + if ( (MPI_GROUP_NULL == group) || (NULL == group) || + (NULL == new_group) ) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP, FUNC_NAME); } diff --git a/ompi/mpi/c/group_range_incl.c b/ompi/mpi/c/group_range_incl.c index acfbe2e7cc..0609adf885 100644 --- a/ompi/mpi/c/group_range_incl.c +++ b/ompi/mpi/c/group_range_incl.c @@ -10,6 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006 University of Houston. All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -49,7 +50,8 @@ int MPI_Group_range_incl(MPI_Group group, int n_triplets, int ranges[][3], if( MPI_PARAM_CHECK ) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if ( (MPI_GROUP_NULL == group) || (NULL == group) ) { + if ( (MPI_GROUP_NULL == group) || (NULL == group) || + (NULL == new_group) ) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP, FUNC_NAME); } diff --git a/ompi/mpi/c/group_rank.c b/ompi/mpi/c/group_rank.c index dd5438bf3e..640de59af8 100644 --- a/ompi/mpi/c/group_rank.c +++ b/ompi/mpi/c/group_rank.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -43,6 +44,9 @@ int MPI_Group_rank(MPI_Group group, int *rank) if( (MPI_GROUP_NULL == group) || ( NULL == group) ){ return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP, FUNC_NAME); + } else if (NULL == rank) { + return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, + FUNC_NAME); } } diff --git a/ompi/mpi/c/group_size.c b/ompi/mpi/c/group_size.c index 38511792cd..ea1374bb7f 100644 --- a/ompi/mpi/c/group_size.c +++ b/ompi/mpi/c/group_size.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -44,6 +45,9 @@ int MPI_Group_size(MPI_Group group, int *size) if( (MPI_GROUP_NULL == group) || (NULL == group) ) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP, FUNC_NAME); + } else if (NULL == size) { + return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, + FUNC_NAME); } } diff --git a/ompi/mpi/c/group_union.c b/ompi/mpi/c/group_union.c index 15f0203dc6..e95a1a29de 100644 --- a/ompi/mpi/c/group_union.c +++ b/ompi/mpi/c/group_union.c @@ -10,6 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006 University of Houston. All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -47,7 +48,8 @@ int MPI_Group_union(MPI_Group group1, MPI_Group group2, MPI_Group *new_group) OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if ((MPI_GROUP_NULL == group1) || (MPI_GROUP_NULL == group2) || - (NULL == group1) || (NULL == group2) ) { + (NULL == group1) || (NULL == group2) || + (NULL == new_group)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP, FUNC_NAME); diff --git a/ompi/mpi/c/ibsend.c b/ompi/mpi/c/ibsend.c index 7eaa1cbe67..8418ef9917 100644 --- a/ompi/mpi/c/ibsend.c +++ b/ompi/mpi/c/ibsend.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -46,8 +47,6 @@ int MPI_Ibsend(void *buf, int count, MPI_Datatype type, int dest, return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } else if (count < 0) { rc = MPI_ERR_COUNT; - } else if (type == MPI_DATATYPE_NULL) { - rc = MPI_ERR_TYPE; } else if (tag < 0 || tag > mca_pml.pml_max_tag) { rc = MPI_ERR_TAG; } else if (ompi_comm_peer_invalid(comm, dest) && diff --git a/ompi/mpi/c/irecv.c b/ompi/mpi/c/irecv.c index b9ebf2a32e..9b1f030c1e 100644 --- a/ompi/mpi/c/irecv.c +++ b/ompi/mpi/c/irecv.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -52,6 +53,8 @@ int MPI_Irecv(void *buf, int count, MPI_Datatype type, int source, (MPI_PROC_NULL != source) && ompi_comm_peer_invalid(comm, source)) { rc = MPI_ERR_RANK; + } else if (NULL == request) { + rc = MPI_ERR_REQUEST; } OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/irsend.c b/ompi/mpi/c/irsend.c index 9be2d94dc4..e37369c6f5 100644 --- a/ompi/mpi/c/irsend.c +++ b/ompi/mpi/c/irsend.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -47,8 +48,6 @@ int MPI_Irsend(void *buf, int count, MPI_Datatype type, int dest, return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } else if (count < 0) { rc = MPI_ERR_COUNT; - } else if (type == MPI_DATATYPE_NULL) { - rc = MPI_ERR_TYPE; } else if (tag < 0 || tag > mca_pml.pml_max_tag) { rc = MPI_ERR_TAG; } else if (ompi_comm_peer_invalid(comm, dest) && @@ -56,6 +55,9 @@ int MPI_Irsend(void *buf, int count, MPI_Datatype type, int dest, rc = MPI_ERR_RANK; } else if (request == NULL) { rc = MPI_ERR_REQUEST; + } else { + OMPI_CHECK_DATATYPE_FOR_SEND(rc, type, count); + OMPI_CHECK_USER_BUFFER(rc, buf, type, count); } OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/isend.c b/ompi/mpi/c/isend.c index 087a8e5f37..ac30c46dc9 100644 --- a/ompi/mpi/c/isend.c +++ b/ompi/mpi/c/isend.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -46,7 +47,7 @@ int MPI_Isend(void *buf, int count, MPI_Datatype type, int dest, return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } else if (count < 0) { rc = MPI_ERR_COUNT; - } else if (type == MPI_DATATYPE_NULL) { + } else if (MPI_DATATYPE_NULL == type || NULL == type) { rc = MPI_ERR_TYPE; } else if (tag < 0 || tag > mca_pml.pml_max_tag) { rc = MPI_ERR_TAG; diff --git a/ompi/mpi/c/issend.c b/ompi/mpi/c/issend.c index dec9169112..35afe0eb5f 100644 --- a/ompi/mpi/c/issend.c +++ b/ompi/mpi/c/issend.c @@ -46,8 +46,6 @@ int MPI_Issend(void *buf, int count, MPI_Datatype type, int dest, return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } else if (count < 0) { rc = MPI_ERR_COUNT; - } else if (type == MPI_DATATYPE_NULL) { - rc = MPI_ERR_TYPE; } else if (tag < 0 || tag > mca_pml.pml_max_tag) { rc = MPI_ERR_TAG; } else if (ompi_comm_peer_invalid(comm, dest) && diff --git a/ompi/mpi/c/pack.c b/ompi/mpi/c/pack.c index 44b5783b2b..5019071f45 100644 --- a/ompi/mpi/c/pack.c +++ b/ompi/mpi/c/pack.c @@ -11,6 +11,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -48,7 +49,7 @@ int MPI_Pack(void *inbuf, int incount, MPI_Datatype datatype, if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (MPI_COMM_NULL == comm) { + if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } else if ((NULL == outbuf) || (NULL == position)) { /* inbuf can be MPI_BOTTOM */ return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME); @@ -56,7 +57,7 @@ int MPI_Pack(void *inbuf, int incount, MPI_Datatype datatype, return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_COUNT, FUNC_NAME); } else if (outsize < 0) { return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME); - } else if (MPI_DATATYPE_NULL == datatype) { + } else if (MPI_DATATYPE_NULL == datatype || NULL == datatype) { return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TYPE, FUNC_NAME); } } diff --git a/ompi/mpi/c/pack_external.c b/ompi/mpi/c/pack_external.c index d719e02c14..2ffd19a6af 100644 --- a/ompi/mpi/c/pack_external.c +++ b/ompi/mpi/c/pack_external.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -53,7 +54,7 @@ int MPI_Pack_external(char *datarep, void *inbuf, int incount, return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COUNT, FUNC_NAME); } else if (outsize < 0) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME); - } else if (MPI_DATATYPE_NULL == datatype) { + } else if (MPI_DATATYPE_NULL == datatype || NULL == datatype) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TYPE, FUNC_NAME); } } diff --git a/ompi/mpi/c/pack_external_size.c b/ompi/mpi/c/pack_external_size.c index 7d2eb8bcd9..2679f92182 100644 --- a/ompi/mpi/c/pack_external_size.c +++ b/ompi/mpi/c/pack_external_size.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -45,7 +46,7 @@ int MPI_Pack_external_size(char *datarep, int incount, OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if (NULL == size) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME); - } else if (MPI_DATATYPE_NULL == datatype) { + } else if (MPI_DATATYPE_NULL == datatype || NULL == datatype) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TYPE, FUNC_NAME); } } diff --git a/ompi/mpi/c/pack_size.c b/ompi/mpi/c/pack_size.c index a38af4e1ff..78bfc55235 100644 --- a/ompi/mpi/c/pack_size.c +++ b/ompi/mpi/c/pack_size.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -42,12 +43,12 @@ int MPI_Pack_size(int incount, MPI_Datatype datatype, MPI_Comm comm, if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (MPI_COMM_NULL == comm) { + if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } else if (NULL == size) { return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME); - } else if (MPI_DATATYPE_NULL == datatype) { + } else if (MPI_DATATYPE_NULL == datatype || NULL == datatype) { return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TYPE, FUNC_NAME); } } diff --git a/ompi/mpi/c/put.c b/ompi/mpi/c/put.c index e0b1559f87..9a9c75f965 100644 --- a/ompi/mpi/c/put.c +++ b/ompi/mpi/c/put.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -56,6 +57,9 @@ int MPI_Put(void *origin_addr, int origin_count, MPI_Datatype origin_datatype, rc = MPI_ERR_RANK; } else if (!ompi_win_comm_allowed(win)) { rc = MPI_ERR_RMA_SYNC; + } else if (NULL == target_datatype || + MPI_DATATYPE_NULL == target_datatype) { + rc = MPI_ERR_TYPE; } else if ( target_disp < 0 ) { rc = MPI_ERR_DISP; } else if ( (origin_count < 0) || (target_count < 0) ) { diff --git a/ompi/mpi/c/recv_init.c b/ompi/mpi/c/recv_init.c index 10e0159c00..5ad5e1f083 100644 --- a/ompi/mpi/c/recv_init.c +++ b/ompi/mpi/c/recv_init.c @@ -53,6 +53,8 @@ int MPI_Recv_init(void *buf, int count, MPI_Datatype type, int source, (MPI_PROC_NULL != source) && ompi_comm_peer_invalid(comm, source)) { rc = MPI_ERR_RANK; + } else if (NULL == request) { + rc = MPI_ERR_REQUEST; } OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); diff --git a/ompi/mpi/c/reduce.c b/ompi/mpi/c/reduce.c index a0e8da3245..50220aa211 100644 --- a/ompi/mpi/c/reduce.c +++ b/ompi/mpi/c/reduce.c @@ -52,7 +52,7 @@ int MPI_Reduce(void *sendbuf, void *recvbuf, int count, /* Checks for all ranks */ - else if (MPI_OP_NULL == op) { + else if (MPI_OP_NULL == op || NULL == op) { err = MPI_ERR_OP; } else if (!ompi_op_is_valid(op, datatype, &msg, FUNC_NAME)) { int ret = OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_OP, msg); diff --git a/ompi/mpi/c/reduce_scatter.c b/ompi/mpi/c/reduce_scatter.c index 73be60e5fa..68e94993f9 100644 --- a/ompi/mpi/c/reduce_scatter.c +++ b/ompi/mpi/c/reduce_scatter.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -52,7 +53,7 @@ int MPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts, /* Unrooted operation; same checks for all ranks on both intracommunicators and intercommunicators */ - else if (MPI_OP_NULL == op) { + else if (MPI_OP_NULL == op || NULL == op) { err = MPI_ERR_OP; } else if (!ompi_op_is_valid(op, datatype, &msg, FUNC_NAME)) { int ret = OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_OP, msg); diff --git a/ompi/mpi/c/request_free.c b/ompi/mpi/c/request_free.c index ed64777902..b6e1f6898e 100644 --- a/ompi/mpi/c/request_free.c +++ b/ompi/mpi/c/request_free.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -42,7 +43,7 @@ int MPI_Request_free(MPI_Request *request) if (MPI_PARAM_CHECK) { rc = MPI_SUCCESS; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (NULL == request) { + if (NULL == request || NULL == *request) { rc = MPI_ERR_REQUEST; } OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME); diff --git a/ompi/mpi/c/request_get_status.c b/ompi/mpi/c/request_get_status.c index a697804f59..bb3ef2ecb2 100644 --- a/ompi/mpi/c/request_get_status.c +++ b/ompi/mpi/c/request_get_status.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (C) 2006 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -46,6 +46,9 @@ int MPI_Request_get_status(MPI_Request request, int *flag, OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if( (NULL == flag) || (NULL == status) ) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME); + } else if (NULL == request) { + return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_REQUEST, + FUNC_NAME); } } diff --git a/ompi/mpi/c/rsend.c b/ompi/mpi/c/rsend.c index bf7fcf563b..f2f20a3f4f 100644 --- a/ompi/mpi/c/rsend.c +++ b/ompi/mpi/c/rsend.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -45,7 +46,7 @@ int MPI_Rsend(void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Co return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } else if (count < 0) { rc = MPI_ERR_COUNT; - } else if (type == MPI_DATATYPE_NULL) { + } else if (MPI_DATATYPE_NULL == type || NULL == type) { rc = MPI_ERR_TYPE; } else if (tag < 0 || tag > mca_pml.pml_max_tag) { rc = MPI_ERR_TAG; diff --git a/ompi/mpi/c/rsend_init.c b/ompi/mpi/c/rsend_init.c index c9010b4cd4..3bf58f8b88 100644 --- a/ompi/mpi/c/rsend_init.c +++ b/ompi/mpi/c/rsend_init.c @@ -49,7 +49,7 @@ int MPI_Rsend_init(void *buf, int count, MPI_Datatype type, return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } else if (count < 0) { rc = MPI_ERR_COUNT; - } else if (type == MPI_DATATYPE_NULL) { + } else if (MPI_DATATYPE_NULL == type || NULL == type) { rc = MPI_ERR_TYPE; } else if (tag < 0 || tag > mca_pml.pml_max_tag) { rc = MPI_ERR_TAG; diff --git a/ompi/mpi/c/scan.c b/ompi/mpi/c/scan.c index eab9263e60..d6cd632855 100644 --- a/ompi/mpi/c/scan.c +++ b/ompi/mpi/c/scan.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -58,7 +59,7 @@ int MPI_Scan(void *sendbuf, void *recvbuf, int count, /* Unrooted operation; checks for all ranks */ - else if (MPI_OP_NULL == op) { + else if (MPI_OP_NULL == op || NULL == op) { err = MPI_ERR_OP; } else if (MPI_IN_PLACE == recvbuf) { err = MPI_ERR_ARG; diff --git a/ompi/mpi/c/scatter.c b/ompi/mpi/c/scatter.c index 6954ba9ef3..e9e7936f89 100644 --- a/ompi/mpi/c/scatter.c +++ b/ompi/mpi/c/scatter.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -64,7 +64,7 @@ int MPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype, } else if (MPI_IN_PLACE != recvbuf) { if (recvcount < 0) { err = MPI_ERR_COUNT; - } else if (MPI_DATATYPE_NULL == recvtype) { + } else if (MPI_DATATYPE_NULL == recvtype || NULL == recvtype) { err = MPI_ERR_TYPE; } } diff --git a/ompi/mpi/c/scatterv.c b/ompi/mpi/c/scatterv.c index 3637a08d32..044a4decf1 100644 --- a/ompi/mpi/c/scatterv.c +++ b/ompi/mpi/c/scatterv.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -68,7 +68,7 @@ int MPI_Scatterv(void *sendbuf, int *sendcounts, int *displs, FUNC_NAME); } - if (MPI_DATATYPE_NULL == recvtype) { + if (MPI_DATATYPE_NULL == recvtype || NULL == recvtype) { return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TYPE, FUNC_NAME); } @@ -112,7 +112,7 @@ int MPI_Scatterv(void *sendbuf, int *sendcounts, int *displs, return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_COUNT, FUNC_NAME); } - if (MPI_DATATYPE_NULL == recvtype) { + if (MPI_DATATYPE_NULL == recvtype || NULL == recvtype) { return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TYPE, FUNC_NAME); } } diff --git a/ompi/mpi/c/send_init.c b/ompi/mpi/c/send_init.c index 4a6c30ef80..d19afe8bf1 100644 --- a/ompi/mpi/c/send_init.c +++ b/ompi/mpi/c/send_init.c @@ -48,8 +48,6 @@ int MPI_Send_init(void *buf, int count, MPI_Datatype type, return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } else if (count < 0) { rc = MPI_ERR_COUNT; - } else if (type == MPI_DATATYPE_NULL) { - rc = MPI_ERR_TYPE; } else if (tag < 0 || tag > mca_pml.pml_max_tag) { rc = MPI_ERR_TAG; } else if (ompi_comm_peer_invalid(comm, dest) && diff --git a/ompi/mpi/c/ssend.c b/ompi/mpi/c/ssend.c index 152436888e..6c5a6baf98 100644 --- a/ompi/mpi/c/ssend.c +++ b/ompi/mpi/c/ssend.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -44,7 +45,7 @@ int MPI_Ssend(void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Co return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } else if (count < 0) { rc = MPI_ERR_COUNT; - } else if (type == MPI_DATATYPE_NULL) { + } else if (MPI_DATATYPE_NULL == type || NULL == type) { rc = MPI_ERR_TYPE; } else if (tag < 0 || tag > mca_pml.pml_max_tag) { rc = MPI_ERR_TAG; diff --git a/ompi/mpi/c/ssend_init.c b/ompi/mpi/c/ssend_init.c index be4e9cb515..8c6303562a 100644 --- a/ompi/mpi/c/ssend_init.c +++ b/ompi/mpi/c/ssend_init.c @@ -49,7 +49,7 @@ int MPI_Ssend_init(void *buf, int count, MPI_Datatype type, return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } else if (count < 0) { rc = MPI_ERR_COUNT; - } else if (type == MPI_DATATYPE_NULL) { + } else if (MPI_DATATYPE_NULL == type || NULL == type) { rc = MPI_ERR_TYPE; } else if (tag < 0 || tag > mca_pml.pml_max_tag) { rc = MPI_ERR_TAG; diff --git a/ompi/mpi/c/startall.c b/ompi/mpi/c/startall.c index c5193b8d99..0cf22be47b 100644 --- a/ompi/mpi/c/startall.c +++ b/ompi/mpi/c/startall.c @@ -36,11 +36,10 @@ static const char FUNC_NAME[] = "MPI_Startall"; int MPI_Startall(int count, MPI_Request *requests) { - int i; - OPAL_CR_TEST_CHECKPOINT_READY(); if ( MPI_PARAM_CHECK ) { + int i; int rc = MPI_SUCCESS; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if (NULL == requests) { @@ -49,8 +48,9 @@ int MPI_Startall(int count, MPI_Request *requests) rc = MPI_ERR_ARG; } for (i = 0; i < count; ++i) { - if (OMPI_REQUEST_PML != requests[i]->req_type && - OMPI_REQUEST_NOOP != requests[i]->req_type) { + if (NULL == requests[i] || + (OMPI_REQUEST_PML != requests[i]->req_type && + OMPI_REQUEST_NOOP != requests[i]->req_type)) { rc = MPI_ERR_REQUEST; break; } diff --git a/ompi/mpi/c/testall.c b/ompi/mpi/c/testall.c index 8b56d1385a..89e00dbb22 100644 --- a/ompi/mpi/c/testall.c +++ b/ompi/mpi/c/testall.c @@ -37,15 +37,20 @@ static const char FUNC_NAME[] = "MPI_Testall"; int MPI_Testall(int count, MPI_Request requests[], int *flag, MPI_Status statuses[]) { - OPAL_CR_TEST_CHECKPOINT_READY(); if ( MPI_PARAM_CHECK ) { - int rc = MPI_SUCCESS; + int i, rc = MPI_SUCCESS; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if( (NULL == requests) && (0 != count) ) { rc = MPI_ERR_REQUEST; } + for (i = 0; i < count; ++i) { + if (NULL == requests[i]) { + rc = MPI_ERR_REQUEST; + break; + } + } OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/testany.c b/ompi/mpi/c/testany.c index 6fd7a9d25e..43a122e7f0 100644 --- a/ompi/mpi/c/testany.c +++ b/ompi/mpi/c/testany.c @@ -40,6 +40,7 @@ int MPI_Testany(int count, MPI_Request requests[], int *index, int *completed, M OPAL_CR_TEST_CHECKPOINT_READY(); if ( MPI_PARAM_CHECK ) { + int i; int rc = MPI_SUCCESS; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if( 0 != count ) { @@ -48,6 +49,12 @@ int MPI_Testany(int count, MPI_Request requests[], int *index, int *completed, M } else if (NULL == index) { rc = MPI_ERR_ARG; } + for (i = 0; i < count; ++i) { + if (NULL == requests[i]) { + rc = MPI_ERR_REQUEST; + break; + } + } } OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/testsome.c b/ompi/mpi/c/testsome.c index a1912b0513..a2e9251fd7 100644 --- a/ompi/mpi/c/testsome.c +++ b/ompi/mpi/c/testsome.c @@ -41,7 +41,7 @@ int MPI_Testsome(int incount, MPI_Request *requests, OPAL_CR_TEST_CHECKPOINT_READY(); if ( MPI_PARAM_CHECK ) { - int rc = MPI_SUCCESS; + int index, rc = MPI_SUCCESS; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if( 0 != incount ) { if( NULL == requests) { @@ -49,6 +49,12 @@ int MPI_Testsome(int incount, MPI_Request *requests, } else if ((NULL == outcount) || (NULL == indices)) { rc = MPI_ERR_ARG; } + for (index = 0; index < incount; ++index) { + if (NULL == requests[index]) { + rc = MPI_ERR_REQUEST; + break; + } + } } OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/type_commit.c b/ompi/mpi/c/type_commit.c index 3d130f1e1a..233b9b8876 100644 --- a/ompi/mpi/c/type_commit.c +++ b/ompi/mpi/c/type_commit.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -40,7 +41,7 @@ int MPI_Type_commit(MPI_Datatype *type) if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (NULL == type || MPI_DATATYPE_NULL == *type) { + if (NULL == type || NULL == *type || MPI_DATATYPE_NULL == *type) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TYPE, FUNC_NAME); } } diff --git a/ompi/mpi/c/type_contiguous.c b/ompi/mpi/c/type_contiguous.c index 11091144e0..d5fe7c3748 100644 --- a/ompi/mpi/c/type_contiguous.c +++ b/ompi/mpi/c/type_contiguous.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -42,7 +43,7 @@ int MPI_Type_contiguous(int count, if( MPI_PARAM_CHECK ) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (MPI_DATATYPE_NULL == oldtype || NULL == newtype || + if (MPI_DATATYPE_NULL == oldtype || NULL == oldtype || NULL == newtype) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TYPE, FUNC_NAME); } else if( count < 0 ) { diff --git a/ompi/mpi/c/unpack.c b/ompi/mpi/c/unpack.c index 1e9036f2bd..f1ce5daa49 100644 --- a/ompi/mpi/c/unpack.c +++ b/ompi/mpi/c/unpack.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -60,7 +61,7 @@ int MPI_Unpack(void *inbuf, int insize, int *position, return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_COUNT, FUNC_NAME); } - if (MPI_DATATYPE_NULL == datatype) { + if (MPI_DATATYPE_NULL == datatype || NULL == datatype) { return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TYPE, FUNC_NAME); } } diff --git a/ompi/mpi/c/unpack_external.c b/ompi/mpi/c/unpack_external.c index 16fe16a739..e76883cef0 100644 --- a/ompi/mpi/c/unpack_external.c +++ b/ompi/mpi/c/unpack_external.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -50,7 +51,7 @@ int MPI_Unpack_external (char *datarep, void *inbuf, MPI_Aint insize, return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME); } else if (outcount < 0) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COUNT, FUNC_NAME); - } else if (MPI_DATATYPE_NULL == datatype) { + } else if (MPI_DATATYPE_NULL == datatype || NULL == datatype) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TYPE, FUNC_NAME); } } diff --git a/ompi/mpi/c/waitsome.c b/ompi/mpi/c/waitsome.c index 39bbe6c2f6..173be7c6c7 100644 --- a/ompi/mpi/c/waitsome.c +++ b/ompi/mpi/c/waitsome.c @@ -43,11 +43,17 @@ int MPI_Waitsome(int incount, MPI_Request *requests, OPAL_CR_TEST_CHECKPOINT_READY(); if ( MPI_PARAM_CHECK ) { - int rc = MPI_SUCCESS; + int index, rc = MPI_SUCCESS; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if ((0 != incount) && (NULL == requests)) { rc = MPI_ERR_REQUEST; } + for (index = 0; index < incount; ++index) { + if (NULL == requests[index]) { + rc = MPI_ERR_REQUEST; + break; + } + } if ((NULL == outcount) || (NULL == indices)) { rc = MPI_ERR_ARG; }