From 0d5640fee91ae4ca8aa5e61fbf65ff726e7822d2 Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Sat, 2 Sep 2017 20:38:24 +0200 Subject: [PATCH] see if that pleases scan-build --- src/smpi/bindings/smpi_pmpi_request.cpp | 9 ++++++--- src/smpi/colls/smpi_mvapich2_selector.cpp | 10 ++++------ src/smpi/mpi/smpi_win.cpp | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/smpi/bindings/smpi_pmpi_request.cpp b/src/smpi/bindings/smpi_pmpi_request.cpp index 926b55c349..c8ef0ec622 100644 --- a/src/smpi/bindings/smpi_pmpi_request.cpp +++ b/src/smpi/bindings/smpi_pmpi_request.cpp @@ -645,6 +645,9 @@ int PMPI_Waitany(int count, MPI_Request requests[], int *index, MPI_Status * sta { if (index == nullptr) return MPI_ERR_ARG; + + if (count <= 0) + return MPI_SUCCESS; smpi_bench_end(); //save requests information for tracing @@ -656,9 +659,9 @@ int PMPI_Waitany(int count, MPI_Request requests[], int *index, MPI_Status * sta MPI_Comm comm; } savedvalstype; savedvalstype* savedvals=nullptr; - if(count>0){ - savedvals = xbt_new0(savedvalstype, count); - } + + savedvals = xbt_new0(savedvalstype, count); + for (int i = 0; i < count; i++) { MPI_Request req = requests[i]; //already received requests are no longer valid if (req) { diff --git a/src/smpi/colls/smpi_mvapich2_selector.cpp b/src/smpi/colls/smpi_mvapich2_selector.cpp index 837584f694..1d6978c3a1 100644 --- a/src/smpi/colls/smpi_mvapich2_selector.cpp +++ b/src/smpi/colls/smpi_mvapich2_selector.cpp @@ -64,7 +64,7 @@ int Coll_alltoall_mvapich2::alltoall( void *sendbuf, int sendcount, ||nbytes > mv2_alltoall_thresholds_table[conf_index][range].in_place_algo_table[range_threshold].max ) { tmp_buf = (char *)smpi_get_tmp_sendbuffer( comm_size * recvcount * recvtype_size ); - mpi_errno = Datatype::copy((char *)recvbuf, + Datatype::copy((char *)recvbuf, comm_size*recvcount, recvtype, (char *)tmp_buf, comm_size*recvcount, recvtype); @@ -622,11 +622,9 @@ int Coll_bcast_mvapich2::bcast(void *buffer, { shmem_comm = comm->get_intra_comm(); if (not is_contig || not is_homogeneous) { - mpi_errno = MPIR_Bcast_tune_inter_node_helper_MV2(tmp_buf, nbytes, MPI_BYTE, root, comm); + MPIR_Bcast_tune_inter_node_helper_MV2(tmp_buf, nbytes, MPI_BYTE, root, comm); } else { - mpi_errno = - MPIR_Bcast_tune_inter_node_helper_MV2(buffer, count, datatype, root, - comm); + MPIR_Bcast_tune_inter_node_helper_MV2(buffer, count, datatype, root, comm); } /* We are now done with the inter-node phase */ @@ -847,7 +845,7 @@ int Coll_reduce_scatter_mvapich2::reduce_scatter(void *sendbuf, void *recvbuf, i while (pof2 < comm_size) pof2 <<= 1; if (pof2 == comm_size && is_block_regular) { /* noncommutative, pof2 size, and block regular */ - mpi_errno = MPIR_Reduce_scatter_non_comm_MV2(sendbuf, recvbuf, + MPIR_Reduce_scatter_non_comm_MV2(sendbuf, recvbuf, recvcnts, datatype, op, comm); } diff --git a/src/smpi/mpi/smpi_win.cpp b/src/smpi/mpi/smpi_win.cpp index f9761085cf..02c7765ea1 100644 --- a/src/smpi/mpi/smpi_win.cpp +++ b/src/smpi/mpi/smpi_win.cpp @@ -413,7 +413,7 @@ int Win::compare_and_swap(void *origin_addr, void *compare_addr, } XBT_DEBUG("Entering MPI_Compare_and_swap with %d", target_rank); - MPI_Request req; + MPI_Request req = MPI_REQUEST_NULL; xbt_mutex_acquire(send_win->atomic_mut_); get(result_addr, 1, datatype, target_rank, target_disp, 1, datatype, &req); -- 2.20.1