From 6cf57242a375fb0186c9eefcf46fcff848d54b19 Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Sat, 6 Apr 2019 14:54:02 +0200 Subject: [PATCH] please herr sonar --- src/smpi/bindings/smpi_pmpi_coll.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/smpi/bindings/smpi_pmpi_coll.cpp b/src/smpi/bindings/smpi_pmpi_coll.cpp index c4f8183dca..2eb62c2c09 100644 --- a/src/smpi/bindings/smpi_pmpi_coll.cpp +++ b/src/smpi/bindings/smpi_pmpi_coll.cpp @@ -760,7 +760,9 @@ int PMPI_Ialltoall(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* re MPI_Datatype sendtmptype = sendtype; if (sendbuf == MPI_IN_PLACE) { sendtmpbuf = static_cast(xbt_malloc(recvcount * comm->size() * recvtype->size())); - memcpy(sendtmpbuf, recvbuf, recvcount * comm->size() * recvtype->size()); + //memcpy(??,nullptr,0) is actually undefined behavor, even if harmless. + if(recvbuf != nullptr) + memcpy(sendtmpbuf, recvbuf, recvcount * comm->size() * recvtype->size()); sendtmpcount = recvcount; sendtmptype = recvtype; } -- 2.20.1