This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] Add stat=/errmsg= support to _gfortran_caf_register
- From: Mikael Morin <mikael dot morin at sfr dot fr>
- To: fortran at gcc dot gnu dot org
- Cc: Tobias Burnus <burnus at net-b dot de>, gcc patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 7 Jul 2011 13:35:33 +0200
- Subject: Re: [Patch, Fortran] Add stat=/errmsg= support to _gfortran_caf_register
- References: <4E15458B.8050901@net-b.de>
On Thursday 07 July 2011 07:35:07 Tobias Burnus wrote:
> diff --git a/libgfortran/caf/mpi.c b/libgfortran/caf/mpi.c
> index 83f39f6..2d4af6b 100644
> --- a/libgfortran/caf/mpi.c
> +++ b/libgfortran/caf/mpi.c
> @@ -103,10 +110,19 @@ _gfortran_caf_register (ptrdiff_t size, caf_register_t
type,
> /* Token contains only a list of pointers. */
> local = malloc (size);
> token = malloc (sizeof (void*) * caf_num_images);
> +
Trailing blanks
> + if (unlikely (local == NULL || token == NULL))
> + goto error;
>
> /* token[img-1] is the address of the token in image "img". */
> - MPI_Allgather (&local, sizeof (void*), MPI_BYTE,
> - token, sizeof (void*), MPI_BYTE, MPI_COMM_WORLD);
> + err = MPI_Allgather (&local, sizeof (void*), MPI_BYTE, token,
> + sizeof (void*), MPI_BYTE, MPI_COMM_WORLD);
> + if (unlikely (err))
> + {
> + free (local);
> + free (token);
> + goto error;
> + }
>
> if (type == CAF_REGTYPE_COARRAY_STATIC)
> {
This will return the same error (memory allocation failure) as in the case
just above. Is this expected or should it have an error of its own?
> + char *msg;
> + if (caf_is_finalized)
Space indentation
> + msg = "Failed to allocate coarray - stopped images";
Also I'm wondering whether it would be pertinent to share the error handling
between single.c (one error) and mpi.c (2 or 3 errors) as the codes are very
close (with an interface such as handle_error (int *stat, char *errmsg, int
errmsg_len, char *actual_error)).
> Build and regtested on x86-64-linux.
> OK for the trunk?
The above is nitpicking, and I leave the final decision to you and Daniel, so
the patch is basically OK with the two indentation nits fixed.
Mikael