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

Reply via email to