X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3297da9f47ce18371941b2b48a2f4018b4793ced..bf35e3872ad53be671649d98a147ebc16c92dc2d:/src/smpi/bindings/smpi_f77_comm.cpp diff --git a/src/smpi/bindings/smpi_f77_comm.cpp b/src/smpi/bindings/smpi_f77_comm.cpp index 3e051e5207..219ea38f71 100644 --- a/src/smpi/bindings/smpi_f77_comm.cpp +++ b/src/smpi/bindings/smpi_f77_comm.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2018. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2010-2019. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -37,12 +37,11 @@ void mpi_comm_create_(int* comm, int* group, int* newcomm, int* ierr) { void mpi_comm_free_(int* comm, int* ierr) { MPI_Comm tmp = simgrid::smpi::Comm::f2c(*comm); - - *ierr = MPI_Comm_free(&tmp); - - if(*ierr == MPI_SUCCESS) { + if(tmp != MPI_COMM_WORLD && tmp != MPI_COMM_NULL) { + simgrid::smpi::Comm::destroy(tmp); simgrid::smpi::Comm::free_f(*comm); } + *ierr = MPI_SUCCESS; } void mpi_comm_split_(int* comm, int* color, int* key, int* comm_out, int* ierr) { @@ -102,7 +101,8 @@ void mpi_comm_free_keyval_ (int* keyval, int* ierr) { void mpi_comm_get_name_ (int* comm, char* name, int* len, int* ierr){ *ierr = MPI_Comm_get_name(simgrid::smpi::Comm::f2c(*comm), name, len); if(*len>0) - name[*len]=' '; + for(int i = *len; i=0 && name[count]==' '; count--); + count+=1; + char* tname = xbt_new(char, count+1); + strncpy(tname, name, count); + tname[count]='\0'; *ierr = MPI_Comm_set_name (simgrid::smpi::Comm::f2c(*comm), tname); xbt_free(tname); }