From: Augustin Degomme <26892-adegomme@users.noreply.framagit.org> Date: Mon, 3 Oct 2022 21:38:20 +0000 (+0000) Subject: Don't crash simulation if size is 0 in sendrecv_replace, as it is legal. X-Git-Tag: v3.34~812 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/f0f3a3144c075ed6f1a8868d3493651cabf93d6a Don't crash simulation if size is 0 in sendrecv_replace, as it is legal. --- diff --git a/src/smpi/bindings/smpi_pmpi_request.cpp b/src/smpi/bindings/smpi_pmpi_request.cpp index 96bb98b03e..51f955a404 100644 --- a/src/smpi/bindings/smpi_pmpi_request.cpp +++ b/src/smpi/bindings/smpi_pmpi_request.cpp @@ -437,7 +437,10 @@ int PMPI_Sendrecv_replace(void* buf, int count, MPI_Datatype datatype, int dst, CHECK_BUFFER(1, buf, count, datatype) int size = datatype->get_extent() * count; - xbt_assert(size > 0); + if (size == 0) + return MPI_SUCCESS; + else if (size <0) + return MPI_ERR_ARG; std::vector recvbuf(size); retval = MPI_Sendrecv(buf, count, datatype, dst, sendtag, recvbuf.data(), count, datatype, src, recvtag, comm, status);