From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11455 invoked by alias); 18 Jan 2019 19:17:25 -0000 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 Received: (qmail 11426 invoked by uid 89); 18 Jan 2019 19:17:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.9 required=5.0 tests=BAYES_00,GIT_PATCH_1,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=caf, images X-HELO: mail-qt1-f170.google.com Received: from mail-qt1-f170.google.com (HELO mail-qt1-f170.google.com) (209.85.160.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 18 Jan 2019 19:17:21 +0000 Received: by mail-qt1-f170.google.com with SMTP id r14so16504160qtp.1 for ; Fri, 18 Jan 2019 11:17:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iastate.edu; s=google20150603; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=DB56R2zk9fshQPC+sbgvhzhix69d8Ym/bMcSb5HDYGk=; b=Izr/exaUP5kkxkgSLfOTigPPfo+MO9iAIaMu2H8APr/5gCycvOnInnAaBiad+sNG+2 QpQLUhJ39c3mSZ1dVDbVabbt41c0kNjAeiB32+co4rdcVgG5YKjAMBl6j1K/5zXtaOia TnA53Gj6WrxeMdikjVFkLMdIiJ7IE26rbU/w0= MIME-Version: 1.0 References: In-Reply-To: From: Nathan Weeks Date: Fri, 18 Jan 2019 19:17:00 -0000 Message-ID: Subject: Re: [PATCH,Fortran][RFC] PR 87939, 87326 - STAT= and ERRMSG= specifiers in several image control statements; NEW_INDEX= specifier in FORM TEAM statement To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-SW-Source: 2019-01/txt/msg01095.txt.bz2 I made a mistake in the ChangeLogs: libgfortran.h is in gcc/fortran, and libcaf.h is in libgfortran/caf. Also, the additional enumerations in those headers don't go all the way in adding support for STAT_UNLOCKED_FAILED_IMAGE to ISO_FORTRAN_ENV itself (it looks like that would be at least a minor modification to gcc/fortran/iso-fortran-env.def, and documentation update in gcc/fortran/intrinsic.texi, and perhaps a test). I've updated the ChangeLogs to clarify all of this. -- Nathan frontend: 2019-01-16 Nathan Weeks PR fortran/87939 PR fortran/87326 * gfortran.h: Add an additional gfc_expr member to struct gfc_code. * libgfortran.h: Add GFC_STAT_UNLOCKED_FAILED_IMAGE. * match.c (gfc_match_critical): Add STAT= and ERRMSG=. (gfc_match_change_team): Likewise. (gfc_match_end_team): Likewise. (gfc_match_sync_team): Likewise. (gfc_match_form_team): Add STAT=, ERRMSG=, and NEW_INDEX=. * resolve.c (resolve_form_team): New. Type check team-variable argument in addition to new STAT= and ERRMSG= arguments. (resolve_change_sync_team): New. Adds type checking for team-value argument. (resolve_end_team): New. (resolve_critical): Add STAT= and ERRMSG=. * trans-decl.c (gfc_build_builtin_function_decls): Additional stat, errmsg, and errmsg_len arguments to _gfortran_caf_form_team(), _gfortran_caf_change_team(), _gfortran_caf_end_team(), and _gfortran_caf_sync_team(), and additional new_index argument to _gfortran_caf_form_team(). * trans-stmt.c (gfc_trans_form_team): Support STAT=, ERRMSG=, and NEW_INDEX=. (gfc_trans_change_team): Support STAT= and ERRMSG=. (gfc_trans_end_team): Likewise. (gfc_trans_sync_team): Likewise. (gfc_trans_critical): Likewise. Also support assigning STAT_FAILED_IMAGE to a stat-variable. libgfortran: 2019-01-16 Nathan Weeks PR fortran/87939 * caf/libcaf.h: Add CAF_STAT_FAILED_IMAGE. testsuite: 2019-01-16 Nathan Weeks PR fortran/87939 PR fortran/87326 * gfortran.dg/coarray_critical_2.f90: New test * gfortran.dg/coarray_critical_3.f90: New test * gfortran.dg/coarray_critical_4.f90: New test * gfortran.dg/team_change_2.f90: New test * gfortran.dg/team_change_3.f90: New test * gfortran.dg/team_end_2.f90: New test * gfortran.dg/team_end_3.f90: New test * gfortran.dg/team_form_2.f90: New test * gfortran.dg/team_form_3.f90: New test * gfortran.dg/team_sync_1.f90: New test * gfortran.dg/team_sync_2.f90: New test -- Nathan On Wed, Jan 16, 2019 at 6:16 PM Nathan Weeks wrote: > > Hi all, > > To facilitate more complete Fortran 2018 failed images support, I'm > particularly interested in interested in seeing PR 87939 eventually > resolved (i.e., allow STAT= and ERRMSG= specifiers in FORM TEAM, > CHANGE TEAM, SYNC TEAM, END TEAM, and CRITICAL statements). To get the > ball rolling (I realize that the boat has been missed for this kind of > change in GCC 9 trunk), I've attempted the following patch (which, > since it was convenient to do while modifying FORM TEAM-related code, > also adds the NEW_INDEX= specifier to the FORM TEAM statement as > desired in PR 87326). > > This is the first gfortran patch I've attempted, and I certainly could > have made some noob mistakes, so verbose feedback would be > appreciated. > > A few comments: > > * In resolve.c, the newly-added functions that type check STAT= and > ERRMSG= arguments for FORM TEAM, CHANGE TEAM, and SYNC TEAM also add > (previously-absent) type checking for their TEAM_TYPE arguments. If > it's more appropriate, I could separate this change into its own PR. > > * The existing -fcoarray=lib implementation of CRITICAL acquires a > LOCK on a lock variable on image 1 (in the current team). However, a > CRITICAL statement stat-value of STAT_FAILED_IMAGE (i.e., the image > that enter the CRITICAL construct failed) is analogous to the LOCK > stat-value of STAT_UNLOCKED_FAILED_IMAGE (i.e., the image that > acquired the lock failed---see section 11.6.11 (7 & 10) in Fortran > 2018 draft N2146), whereas a LOCK STAT_FAILED_IMAGE means the image on > which the lock variable resides has failed (no analog in the CRITICAL > statement, which is oblivious to this underlying implementation). So > in addition to adding the stat value STAT_UNLOCKED_FAILED_IMAGE to > libgfortran.h & libcaf.h, I had CRITICAL swap a LOCK > STAT_UNLOCKED_FAILED_IMAGE for STAT_FAILED_IMAGE, and (perhaps > unimaginatively) a LOCK STAT_FAILED_IMAGE for > STAT_UNLOCKED_FAILED_IMAGE (which, while it has no defined meaning for > a CRITICAL statement, fits the definition of a "processor-dependent > value other than STAT_FAILED_IMAGE"). > > * A couple negative tests for syntax errors (coarray_critical_2.f90 & > team_end_2.f90) fail due to spurious "Error: Expecting END PROGRAM > statement at (1)" errors that are also emitted by gfortran 8.2.0 as > well. > > Thanks, > > -- > Nathan > > frontend: > > 2019-01-16 Nathan Weeks > > PR fortran/87939 > PR fortran/87326 > * gfortran.h: Add an additional gfc_expr member to struct gfc_code. > * libcaf.h: Add support for STAT_UNLOCKED_FAILED_IMAGE. > * match.c (gfc_match_critical): Add STAT= and ERRMSG=. > (gfc_match_change_team): Likewise. > (gfc_match_end_team): Likewise. > (gfc_match_sync_team): Likewise. > (gfc_match_form_team): Add STAT=, ERRMSG=, and NEW_INDEX=. > * resolve.c (resolve_form_team): New. Type check team-variable > argument in > addition to new STAT= and ERRMSG= arguments. > (resolve_change_sync_team): New. Adds type checking for team-value > argument. > (resolve_end_team): New. > (resolve_critical): Add STAT= and ERRMSG=. > * trans-decl.c (gfc_build_builtin_function_decls): Additional stat, > errmsg, and errmsg_len arguments to _gfortran_caf_form_team(), > _gfortran_caf_change_team(), _gfortran_caf_end_team(), and > _gfortran_caf_sync_team(), and additional new_index argument to > _gfortran_caf_form_team(). > * trans-stmt.c (gfc_trans_form_team): Support STAT=, ERRMSG=, and > NEW_INDEX=. > (gfc_trans_change_team): Support STAT= and ERRMSG=. > (gfc_trans_end_team): Likewise. > (gfc_trans_sync_team): Likewise. > (gfc_trans_critical): Likewise. Also support assigning STAT_FAILED_IMAGE > to a stat-variable. > > libgfortran: > > 2019-01-16 Nathan Weeks > > PR fortran/87939 > * libgfortran.h: Add support for STAT_UNLOCKED_FAILED_IMAGE > > testsuite: > > 2019-01-16 Nathan Weeks > > PR fortran/87939 > PR fortran/87326 > * gfortran.dg/coarray_critical_2.f90: New test > * gfortran.dg/coarray_critical_3.f90: New test > * gfortran.dg/coarray_critical_4.f90: New test > * gfortran.dg/team_change_2.f90: New test > * gfortran.dg/team_change_3.f90: New test > * gfortran.dg/team_end_2.f90: New test > * gfortran.dg/team_end_3.f90: New test > * gfortran.dg/team_form_2.f90: New test > * gfortran.dg/team_form_3.f90: New test > * gfortran.dg/team_sync_1.f90: New test > * gfortran.dg/team_sync_2.f90: New test