Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
leak-- (duplicate of a predefined datatype can be released)
[simgrid.git] / src / smpi / smpi_mpi_dt.cpp
index 3463eb8..559db5e 100644 (file)
@@ -179,6 +179,7 @@ int smpi_datatype_dup(MPI_Datatype datatype, MPI_Datatype* new_t)
   *new_t= xbt_new(s_smpi_mpi_datatype_t,1);
   memcpy(*new_t, datatype, sizeof(s_smpi_mpi_datatype_t));
   (*new_t)->in_use=1;
+  (*new_t)->flags &= ~DT_FLAG_PREDEFINED;
   if (datatype->sizeof_substruct){
     (*new_t)->substruct=xbt_malloc(datatype->sizeof_substruct);
     memcpy((*new_t)->substruct, datatype->substruct, datatype->sizeof_substruct);
@@ -488,11 +489,11 @@ void unserialize_contiguous(const void *contiguous_vector, void *noncontiguous_v
 }
 
 void free_contiguous(MPI_Datatype* d){
-  smpi_datatype_unuse(((s_smpi_mpi_indexed_t *)(*d)->substruct)->old_type);
+  smpi_datatype_unuse(((s_smpi_mpi_contiguous_t *)(*d)->substruct)->old_type);
 }
 
 void use_contiguous(MPI_Datatype* d){
-  smpi_datatype_use(((s_smpi_mpi_indexed_t *)(*d)->substruct)->old_type);
+  smpi_datatype_use(((s_smpi_mpi_contiguous_t *)(*d)->substruct)->old_type);
 }
 
 /* Create a Sub type contiguous to be able to serialize and unserialize it the structure s_smpi_mpi_contiguous_t is
@@ -650,11 +651,11 @@ s_smpi_mpi_hvector_t* smpi_datatype_hvector_create( MPI_Aint block_stride, int b
 
 //do nothing for vector types
 void free_hvector(MPI_Datatype* d){
-  smpi_datatype_unuse(((s_smpi_mpi_indexed_t *)(*d)->substruct)->old_type);
+  smpi_datatype_unuse(((s_smpi_mpi_hvector_t *)(*d)->substruct)->old_type);
 }
 
 void use_hvector(MPI_Datatype* d){
-  smpi_datatype_use(((s_smpi_mpi_indexed_t *)(*d)->substruct)->old_type);
+  smpi_datatype_use(((s_smpi_mpi_hvector_t *)(*d)->substruct)->old_type);
 }
 
 int smpi_datatype_hvector(int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* new_type)
@@ -915,7 +916,7 @@ void free_hindexed(MPI_Datatype* type){
 }
 
 void use_hindexed(MPI_Datatype* type){
-  smpi_datatype_use(((s_smpi_mpi_indexed_t *)(*type)->substruct)->old_type);
+  smpi_datatype_use(((s_smpi_mpi_hindexed_t *)(*type)->substruct)->old_type);
 }
 
 /* Create a Sub type hindexed to be able to serialize and unserialize it the structure s_smpi_mpi_hindexed_t is derived