Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix a bug in SMPI that leads to a segfault when one of the request in MPI_StartAll...
[simgrid.git] / src / smpi / smpi_pmpi.c
index 63e69db..367176d 100644 (file)
@@ -923,7 +923,7 @@ int PMPI_Start(MPI_Request * request)
 
   smpi_bench_end();
   if (request == NULL || *request == MPI_REQUEST_NULL) {
-    retval = MPI_ERR_ARG;
+    retval = MPI_ERR_REQUEST;
   } else {
     smpi_mpi_start(*request);
     retval = MPI_SUCCESS;
@@ -935,13 +935,20 @@ int PMPI_Start(MPI_Request * request)
 int PMPI_Startall(int count, MPI_Request * requests)
 {
   int retval = 0;
-
+  int i = 0;
   smpi_bench_end();
   if (requests == NULL) {
     retval = MPI_ERR_ARG;
   } else {
-    smpi_mpi_startall(count, requests);
-    retval = MPI_SUCCESS;
+    for (i = 0 ;  i < count ; i++) {
+      if(requests[i] == MPI_REQUEST_NULL) {
+        retval = MPI_ERR_REQUEST;
+      }
+    }
+    if(retval != MPI_ERR_REQUEST) {
+      smpi_mpi_startall(count, requests);
+      retval = MPI_SUCCESS;
+    }
   }
   smpi_bench_begin();
   return retval;