Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
comm, input validation
authorAugustin Degomme <adegomme@gmail.com>
Sat, 3 Apr 2021 12:49:58 +0000 (14:49 +0200)
committerAugustin Degomme <adegomme@gmail.com>
Sat, 3 Apr 2021 13:50:12 +0000 (15:50 +0200)
src/smpi/bindings/smpi_pmpi_comm.cpp

index 4b17184..b54e1b4 100644 (file)
@@ -108,6 +108,7 @@ int PMPI_Comm_free(MPI_Comm * comm)
 {
   CHECK_NULL(1, MPI_ERR_ARG, comm)
   CHECK_COMM2(1, *comm)
+  CHECK_MPI_NULL(1, MPI_COMM_WORLD, MPI_ERR_COMM, *comm)
   simgrid::smpi::Comm::destroy(*comm);
   *comm = MPI_COMM_NULL;
   return MPI_SUCCESS;
@@ -127,7 +128,7 @@ int PMPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm* comm_out)
 {
   CHECK_NULL(4, MPI_ERR_ARG, comm_out)
   CHECK_COMM2(1, comm)
-  if( color != MPI_UNDEFINED)//we use a negative value for MPI_UNDEFINED 
+  if( color != MPI_UNDEFINED)//we use a negative value for MPI_UNDEFINED
     CHECK_NEGATIVE(3, MPI_ERR_ARG, color)
   smpi_bench_end();
   *comm_out = comm->split(color, key);
@@ -209,6 +210,8 @@ int PMPI_Comm_free_keyval(int* keyval) {
 }
 
 int PMPI_Comm_test_inter(MPI_Comm comm, int* flag){
+  CHECK_COMM(1)
+
   if(flag == nullptr)
     return MPI_ERR_ARG;
   *flag=false;