Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix segfault seen with mpich3-test/perf/nestvec2.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 15 Nov 2017 23:14:09 +0000 (00:14 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 15 Nov 2017 23:14:39 +0000 (00:14 +0100)
src/smpi/mpi/smpi_datatype.cpp

index 4db6870..2457c8f 100644 (file)
@@ -251,7 +251,8 @@ void Datatype::set_name(char* name){
 int Datatype::pack(void* inbuf, int incount, void* outbuf, int outcount, int* position,MPI_Comm comm){
   if (outcount - *position < incount*static_cast<int>(size_))
     return MPI_ERR_BUFFER;
 int Datatype::pack(void* inbuf, int incount, void* outbuf, int outcount, int* position,MPI_Comm comm){
   if (outcount - *position < incount*static_cast<int>(size_))
     return MPI_ERR_BUFFER;
-  Datatype::copy(inbuf, incount, this, static_cast<char*>(outbuf) + *position, outcount, MPI_CHAR);
+  Datatype::copy(inbuf == MPI_BOTTOM ? nullptr : inbuf, incount, this, static_cast<char*>(outbuf) + *position, outcount,
+                 MPI_CHAR);
   *position += incount * size_;
   return MPI_SUCCESS;
 }
   *position += incount * size_;
   return MPI_SUCCESS;
 }
@@ -283,9 +284,9 @@ int Datatype::copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
       if (not smpi_process()->replaying())
         memcpy(recvbuf, sendbuf, count);
     } else if (not(sendtype->flags() & DT_FLAG_DERIVED)) {
       if (not smpi_process()->replaying())
         memcpy(recvbuf, sendbuf, count);
     } else if (not(sendtype->flags() & DT_FLAG_DERIVED)) {
-      recvtype->unserialize( sendbuf, recvbuf, recvcount/recvtype->size(), MPI_REPLACE);
+      recvtype->unserialize(sendbuf, recvbuf, count / recvtype->size(), MPI_REPLACE);
     } else if (not(recvtype->flags() & DT_FLAG_DERIVED)) {
     } else if (not(recvtype->flags() & DT_FLAG_DERIVED)) {
-      sendtype->serialize(sendbuf, recvbuf, sendcount/sendtype->size());
+      sendtype->serialize(sendbuf, recvbuf, count / sendtype->size());
     }else{
 
       void * buf_tmp = xbt_malloc(count);
     }else{
 
       void * buf_tmp = xbt_malloc(count);