Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove uninitialized warning
[simgrid.git] / src / smpi / smpi_pmpi.c
index 485a8c0..9a52cc9 100644 (file)
@@ -478,30 +478,14 @@ int PMPI_Group_difference(MPI_Group group1, MPI_Group group2, MPI_Group * newgro
 
 int PMPI_Group_incl(MPI_Group group, int n, int *ranks, MPI_Group * newgroup)
 {
-  int retval, i, index;
+  int retval;
 
   if (group == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else if (newgroup == NULL) {
     retval = MPI_ERR_ARG;
   } else {
-    if (n == 0) {
-      *newgroup = MPI_GROUP_EMPTY;
-    } else if (n == smpi_group_size(group)) {
-      *newgroup = group;
-      if(group!= smpi_comm_group(MPI_COMM_WORLD)
-                && group != MPI_GROUP_NULL
-                && group != smpi_comm_group(MPI_COMM_SELF)
-                && group != MPI_GROUP_EMPTY)
-      smpi_group_use(group);
-    } else {
-      *newgroup = smpi_group_new(n);
-      for (i = 0; i < n; i++) {
-        index = smpi_group_index(group, ranks[i]);
-        smpi_group_set_mapping(*newgroup, index, i);
-      }
-    }
-    retval = MPI_SUCCESS;
+    retval = smpi_group_incl(group, n, ranks, newgroup);
   }
   return retval;
 }
@@ -1691,6 +1675,8 @@ int PMPI_Bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm c
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
+  } else if (!is_datatype_valid(datatype)) {
+      retval = MPI_ERR_ARG;
   } else {
 #ifdef HAVE_TRACING
   int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
@@ -1956,8 +1942,8 @@ int PMPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (((smpi_comm_rank(comm)==root) && (sendtype == MPI_DATATYPE_NULL))
-             || ((recvbuf !=MPI_IN_PLACE) && (recvtype == MPI_DATATYPE_NULL))) {
+  } else if (((smpi_comm_rank(comm)==root) && (!is_datatype_valid(sendtype)))
+             || ((recvbuf !=MPI_IN_PLACE) && (!is_datatype_valid(recvtype)))){
     retval = MPI_ERR_TYPE;
   } else if ((sendbuf == recvbuf) ||
       ((smpi_comm_rank(comm)==root) && sendcount>0 && (sendbuf == NULL))){