X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/6f5163721d19b5f1e10faa963473225a9b8d6224..cc88d06e4fd1c32dddf17295ff750c60792588e5:/src/smpi/mpi/smpi_comm.cpp diff --git a/src/smpi/mpi/smpi_comm.cpp b/src/smpi/mpi/smpi_comm.cpp index e1cf7e653f..84b9e95c40 100644 --- a/src/smpi/mpi/smpi_comm.cpp +++ b/src/smpi/mpi/smpi_comm.cpp @@ -242,9 +242,14 @@ MPI_Comm Comm::split(int color, int key) /* Gather all colors and keys on rank 0 */ const std::array sendbuf = {{color, key}}; std::vector recvbuf; - if (myrank == 0) + int* recvbuf_ptr; + if (myrank == 0) { recvbuf.resize(2 * size); - gather__default(sendbuf.data(), 2, MPI_INT, recvbuf.data(), 2, MPI_INT, 0, this); + recvbuf_ptr = recvbuf.data(); + } else { + recvbuf_ptr = nullptr; + } + gather__default(sendbuf.data(), 2, MPI_INT, recvbuf_ptr, 2, MPI_INT, 0, this); /* Do the actual job */ if (myrank == 0) { std::vector group_snd(size);