From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17003 invoked by alias); 7 Jul 2011 11:35:57 -0000 Received: (qmail 16934 invoked by uid 22791); 7 Jul 2011 11:35:56 -0000 X-SWARE-Spam-Status: No, hits=-0.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp24.services.sfr.fr (HELO smtp24.services.sfr.fr) (93.17.128.81) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 07 Jul 2011 11:35:38 +0000 Received: from filter.sfr.fr (localhost [127.0.0.1]) by msfrf2402.sfr.fr (SMTP Server) with ESMTP id 9ABA6700008E; Thu, 7 Jul 2011 13:35:36 +0200 (CEST) Received: from gimli.local (59.183.72.86.rev.sfr.net [86.72.183.59]) by msfrf2402.sfr.fr (SMTP Server) with ESMTP id 74A77700008D; Thu, 7 Jul 2011 13:35:36 +0200 (CEST) X-SFR-UUID: 20110707113536477.74A77700008D@msfrf2402.sfr.fr From: Mikael Morin To: fortran@gcc.gnu.org Subject: Re: [Patch, Fortran] Add stat=/errmsg= support to _gfortran_caf_register Date: Thu, 07 Jul 2011 11:42:00 -0000 User-Agent: KMail/1.13.5 (FreeBSD/8.2-PRERELEASE; KDE/4.5.5; amd64; ; ) Cc: Tobias Burnus , gcc patches References: <4E15458B.8050901@net-b.de> In-Reply-To: <4E15458B.8050901@net-b.de> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201107071335.34176.mikael.morin@sfr.fr> X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-07/txt/msg00459.txt.bz2 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