From patchwork Thu Feb 28 20:35:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 1049761 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-497177-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="wdOk3kAj"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 449PSk06d1z9sN1 for ; Fri, 1 Mar 2019 07:35:33 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:in-reply-to:references:date:message-id:mime-version :content-type; q=dns; s=default; b=t3FeSRVKFBI4X8OWFPaf3PLV6YJc6 prlWqJW2Cxnu2c+o9lFAvkl9VsGEekF+A+o4JqRmBSMoPXSlkWUgjriAXYvaV6FL +vuj1Pp866RILvVMzbOGi9+/8YtKjwIsxJvg6IXBntVr+7S+q1bCxfqJlXB7UCrj 1Qt6Me93OisAww= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:in-reply-to:references:date:message-id:mime-version :content-type; s=default; bh=IuV1OZU/VFw+PafuXuWvxw9zsA4=; b=wdO k3kAjcQuK51xtLmfdGzF5mG0jC42/pIO2B1PKQ4rxC6BHw9jj8DGp2jLYMdFc4pC lORaXlU3BvhK8E6r5OGXCfTNuEfsze3Mw6R4337hk2MLqaPjRpRlkeqraNjdNzqL jfhKsZPQUGuemzfaCJJoOvxuAdfZWWY9OGTKsJJY= Received: (qmail 125119 invoked by alias); 28 Feb 2019 20:35:26 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 125090 invoked by uid 89); 28 Feb 2019 20:35:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=3237, Jul, jul X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 28 Feb 2019 20:35:22 +0000 Received: from svr-orw-mbx-05.mgc.mentorg.com ([147.34.90.205]) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1gzSOn-0000pn-Co from Thomas_Schwinge@mentor.com ; Thu, 28 Feb 2019 12:35:21 -0800 Received: from svr-orw-mbx-02.mgc.mentorg.com (147.34.90.202) by SVR-ORW-MBX-05.mgc.mentorg.com (147.34.90.205) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Thu, 28 Feb 2019 12:35:19 -0800 Received: from tftp-cs (147.34.91.1) by svr-orw-mbx-02.mgc.mentorg.com (147.34.90.202) with Microsoft SMTP Server id 15.0.1320.4 via Frontend Transport; Thu, 28 Feb 2019 12:35:19 -0800 Received: by tftp-cs (Postfix, from userid 49978) id A2D01C23D1; Thu, 28 Feb 2019 12:35:18 -0800 (PST) From: Thomas Schwinge To: , Subject: [PR72741] For all Fortran OpenACC 'routine' directive variants check for multiple clauses specifying the level of parallelism In-Reply-To: <579AD9C9.3030804@codesourcery.com> References: <579AD9C9.3030804@codesourcery.com> User-Agent: Notmuch/0.9-125-g4686d11 (http://notmuchmail.org) Emacs/25.2.2 (x86_64-pc-linux-gnu) Date: Thu, 28 Feb 2019 21:35:12 +0100 Message-ID: <875zt3odmn.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Hi! On Thu, 28 Jul 2016 21:21:29 -0700, Cesar Philippidis wrote: > Thomas found a bug in the fortran routine parser where errors involving > invalid combinations of gang, worker, vector and seq clauses were > getting suppressed. [...] > This bug is also present in trunk, but [...] Re-worked a bit, and committed to trunk in r269286 "[PR72741] For all Fortran OpenACC 'routine' directive variants check for multiple clauses specifying the level of parallelism", as attached. Grüße Thomas From 7378dd70e000e78ba7a266349077ab6ef36b5c62 Mon Sep 17 00:00:00 2001 From: tschwinge Date: Thu, 28 Feb 2019 20:31:23 +0000 Subject: [PATCH 2/3] [PR72741] For all Fortran OpenACC 'routine' directive variants check for multiple clauses specifying the level of parallelism gcc/fortran/ PR fortran/72741 * gfortran.h (enum oacc_routine_lop): Add OACC_ROUTINE_LOP_ERROR. * openmp.c (gfc_oacc_routine_lop, gfc_match_oacc_routine): Use it. * trans-decl.c (add_attributes_to_decl): Likewise. gcc/testsuite/ PR fortran/72741 * gfortran.dg/goacc/routine-multiple-lop-clauses-1.f90: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@269286 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 5 +++ gcc/fortran/gfortran.h | 3 +- gcc/fortran/openmp.c | 13 ++++++-- gcc/fortran/trans-decl.c | 1 + gcc/testsuite/ChangeLog | 3 ++ .../goacc/routine-multiple-lop-clauses-1.f90 | 32 +++++++++++++++++++ 6 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/goacc/routine-multiple-lop-clauses-1.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 78c6324d1b83..1c8f71252980 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,6 +1,11 @@ 2019-02-28 Thomas Schwinge Cesar Philippidis + PR fortran/72741 + * gfortran.h (enum oacc_routine_lop): Add OACC_ROUTINE_LOP_ERROR. + * openmp.c (gfc_oacc_routine_lop, gfc_match_oacc_routine): Use it. + * trans-decl.c (add_attributes_to_decl): Likewise. + PR fortran/72741 PR fortran/89433 * openmp.c (gfc_match_oacc_routine): Accept intrinsic symbols. diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index f0258b39ffd1..3e0f634c3a8e 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -323,7 +323,8 @@ enum oacc_routine_lop OACC_ROUTINE_LOP_GANG, OACC_ROUTINE_LOP_WORKER, OACC_ROUTINE_LOP_VECTOR, - OACC_ROUTINE_LOP_SEQ + OACC_ROUTINE_LOP_SEQ, + OACC_ROUTINE_LOP_ERROR }; /* Strings for all symbol attributes. We use these for dumping the diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 6999ac34a1a9..50b91f2150ab 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -2265,7 +2265,7 @@ gfc_oacc_routine_lop (gfc_omp_clauses *clauses) } if (n_lop_clauses > 1) - gfc_error ("Multiple loop axes specified for routine"); + ret = OACC_ROUTINE_LOP_ERROR; } return ret; @@ -2280,6 +2280,7 @@ gfc_match_oacc_routine (void) gfc_symbol *sym = NULL; gfc_omp_clauses *c = NULL; gfc_oacc_routine_name *n = NULL; + oacc_routine_lop lop = OACC_ROUTINE_LOP_NONE; old_loc = gfc_current_locus; @@ -2352,6 +2353,13 @@ gfc_match_oacc_routine (void) != MATCH_YES)) return MATCH_ERROR; + lop = gfc_oacc_routine_lop (c); + if (lop == OACC_ROUTINE_LOP_ERROR) + { + gfc_error ("Multiple loop axes specified for routine at %C"); + goto cleanup; + } + if (isym != NULL) { /* Diagnose any OpenACC 'routine' directive that doesn't match the @@ -2381,8 +2389,7 @@ gfc_match_oacc_routine (void) gfc_current_ns->proc_name->name, &old_loc)) goto cleanup; - gfc_current_ns->proc_name->attr.oacc_routine_lop - = gfc_oacc_routine_lop (c); + gfc_current_ns->proc_name->attr.oacc_routine_lop = lop; } else /* Something has gone wrong, possibly a syntax error. */ diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 20d453051a29..36b7fdd2701f 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -1425,6 +1425,7 @@ add_attributes_to_decl (symbol_attribute sym_attr, tree list) code = OMP_CLAUSE_SEQ; break; case OACC_ROUTINE_LOP_NONE: + case OACC_ROUTINE_LOP_ERROR: default: gcc_unreachable (); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c45e7b7546a9..9f4c598951c3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,9 @@ 2019-02-28 Thomas Schwinge Cesar Philippidis + PR fortran/72741 + * gfortran.dg/goacc/routine-multiple-lop-clauses-1.f90: New file. + PR fortran/72741 PR fortran/89433 * gfortran.dg/goacc/routine-6.f90: Update diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-multiple-lop-clauses-1.f90 b/gcc/testsuite/gfortran.dg/goacc/routine-multiple-lop-clauses-1.f90 new file mode 100644 index 000000000000..8ca9be822ea5 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/routine-multiple-lop-clauses-1.f90 @@ -0,0 +1,32 @@ +! Check for multiple clauses specifying the level of parallelism. + +SUBROUTINE v_1 + !$ACC ROUTINE VECTOR WORKER ! { dg-error "Multiple loop axes specified for routine" } +END SUBROUTINE v_1 + +SUBROUTINE sub_1 + IMPLICIT NONE + EXTERNAL :: g_1 + !$ACC ROUTINE (g_1) GANG WORKER ! { dg-error "Multiple loop axes specified for routine" } + !$ACC ROUTINE (ABORT) SEQ WORKER GANG VECTOR ! { dg-error "Multiple loop axes specified for routine" } + !$ACC ROUTINE WORKER SEQ ! { dg-error "Multiple loop axes specified for routine" } + + CALL v_1 + CALL g_1 + CALL ABORT +END SUBROUTINE sub_1 + +MODULE m_w_1 + IMPLICIT NONE + EXTERNAL :: w_1 + !$ACC ROUTINE VECTOR GANG SEQ ! { dg-error "Multiple loop axes specified for routine" } + !$ACC ROUTINE (w_1) GANG WORKER SEQ ! { dg-error "Multiple loop axes specified for routine" } + !$ACC ROUTINE (ABORT) VECTOR GANG ! { dg-error "Multiple loop axes specified for routine" } + +CONTAINS + SUBROUTINE sub_2 + CALL v_1 + CALL w_1 + CALL ABORT + END SUBROUTINE sub_2 +END MODULE m_w_1 -- 2.17.1