Hi Daniel, Daniel Carrera wrote: > This patch adds a linked list to keep track of the allocated > memory of all static coarrays and ensures that at the end of > the program the memory is freed.
+_gfortran_caf_register (ptrdiff_t size, caf_register_t type, void **token) Between "size," and "caf_register_t" is a <tab> instead of a simple " ". _gfortran_caf_init (int *argc, char ***argv, int *this_image, int *num_images) [...] + if (this_image) + this_image = caf_this_image; + if (num_images) + num_images = caf_num_images; As you mentioned yourself (in a private mail, commenting on my code): There is a "*" missing at the left side of the assignment lines. +_gfortran_caf_register (ptrdiff_t size, caf_register_t type, void **token) [...] + token = malloc (sizeof (void*) * caf_num_images); + + /* Start MPI if not already started. */ + if (caf_num_images == 0) + _gfortran_caf_init (NULL, NULL, NULL, NULL); Wrong order for the "token" allocation: You first need to know how many images exists, before you can use "caf_num_images". + MPI_Allgather (local, sizeof (void*), MPI_BYTE, There is a <tab> character between "local," and "sizeof"; it should have been a space. Have you tested the modifications with MPI? I mean: Compiling mpi.c, and then in gcc/testsuite/gfortran.dg/coarray: for I in *.f90; do echo ====== $I =====; \ mpif90 -fcoarray=lib $I mpi.o && mpiexec -np 3 ./a.out; done Additionally, have you run test suite? It is sufficient to run recompile gfortran (to create the latest libcaf_single.a from single.c) and then to run make check-gfortran RUNTESTFLAGS="caf.exp" (caf.exp is sufficient as the rest of the testsuite does not use libgfortran/caf/single.c, which is the only thing your patch modifies.) Otherwise, your patch looks OK. Tobias, who has currently no access to the GCC source code and can hence not test himself.