From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 118314 invoked by alias); 28 Feb 2019 20:34:04 -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 118283 invoked by uid 89); 28 Feb 2019 20:34:03 -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=gang, PROGRAM, CALL, acc 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:34:01 +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 1gzSNS-0000k4-Uw from Thomas_Schwinge@mentor.com ; Thu, 28 Feb 2019 12:33:58 -0800 Received: from svr-orw-mbx-01.mgc.mentorg.com (147.34.90.201) 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:33:56 -0800 Received: from tftp-cs (147.34.91.1) by svr-orw-mbx-01.mgc.mentorg.com (147.34.90.201) with Microsoft SMTP Server id 15.0.1320.4 via Frontend Transport; Thu, 28 Feb 2019 12:33:56 -0800 Received: by tftp-cs (Postfix, from userid 49978) id 1E9EFC23D1; Thu, 28 Feb 2019 12:33:56 -0800 (PST) From: Thomas Schwinge To: , Subject: [PR72741, PR89433] Accept intrinsic symbols in Fortran OpenACC 'routine' directives In-Reply-To: <87y442ge2w.fsf@hertz.schwinge.homeip.net> References: <305d82b4-08de-fed7-b4f4-ec1c059e0ad3@codesourcery.com> <87y442ge2w.fsf@hertz.schwinge.homeip.net> User-Agent: Notmuch/0.9-125-g4686d11 (http://notmuchmail.org) Emacs/25.2.2 (x86_64-pc-linux-gnu) Date: Thu, 28 Feb 2019 20:37:00 -0000 Message-ID: <877edjodoz.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-SW-Source: 2019-02/txt/msg02119.txt.bz2 --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 623 Hi! On Fri, 12 Aug 2016 18:13:43 +0200, I wrote: > Let me actually break this out of the other pending patches; this should > be uncontroversial. Originally by Cesar, extended by me. OK for trunk? >=20 > commit a0fee96c0f204814e87ddf6635f9cbec2afc6887 > Author: Thomas Schwinge > Date: Fri Aug 12 17:19:05 2016 +0200 >=20 > [PR fortran/72741] Handle intrinsic functions specified in !$ACC ROUT= INE ( NAME ) Re-worked a bit, and committed to trunk in r269285 "[PR72741, PR89433] Accept intrinsic symbols in Fortran OpenACC 'routine' directives", as attached. Gr=C3=BC=C3=9Fe Thomas --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-PR72741-PR89433-Accept-intrinsic-symbols-in-Fortran-.patch Content-Transfer-Encoding: quoted-printable Content-length: 7691 =46rom 1d86d0eb3e7b6c3d799c91fad4bc12da572160fd Mon Sep 17 00:00:00 2001 From: tschwinge Date: Thu, 28 Feb 2019 20:31:01 +0000 Subject: [PATCH 1/3] [PR72741, PR89433] Accept intrinsic symbols in Fortran OpenACC 'routine' directives gcc/fortran/ PR fortran/72741 PR fortran/89433 * openmp.c (gfc_match_oacc_routine): Accept intrinsic symbols. gcc/testsuite/ PR fortran/72741 PR fortran/89433 * gfortran.dg/goacc/routine-6.f90: Update * gfortran.dg/goacc/routine-intrinsic-1.f: New file. * gfortran.dg/goacc/routine-intrinsic-2.f: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@269285 138bc75d-0d04-0410-9= 61f-82ee72b054a4 --- gcc/fortran/ChangeLog | 7 ++++ gcc/fortran/openmp.c | 33 ++++++++++++++++--- gcc/testsuite/ChangeLog | 9 +++++ gcc/testsuite/gfortran.dg/goacc/routine-6.f90 | 7 ++++ .../gfortran.dg/goacc/routine-intrinsic-1.f | 21 ++++++++++++ .../gfortran.dg/goacc/routine-intrinsic-2.f | 23 +++++++++++++ 6 files changed, 95 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/goacc/routine-intrinsic-1.f create mode 100644 gcc/testsuite/gfortran.dg/goacc/routine-intrinsic-2.f diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 85ce5bce5604..78c6324d1b83 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2019-02-28 Thomas Schwinge + Cesar Philippidis + + PR fortran/72741 + PR fortran/89433 + * openmp.c (gfc_match_oacc_routine): Accept intrinsic symbols. + 2019-02-26 Harald Anlauf =20 PR fortran/89492 diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index dfd4be86d50e..6999ac34a1a9 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -2275,8 +2275,9 @@ match gfc_match_oacc_routine (void) { locus old_loc; - gfc_symbol *sym =3D NULL; match m; + gfc_intrinsic_sym *isym =3D NULL; + gfc_symbol *sym =3D NULL; gfc_omp_clauses *c =3D NULL; gfc_oacc_routine_name *n =3D NULL; =20 @@ -2296,12 +2297,19 @@ gfc_match_oacc_routine (void) if (m =3D=3D MATCH_YES) { char buffer[GFC_MAX_SYMBOL_LEN + 1]; - gfc_symtree *st; =20 m =3D gfc_match_name (buffer); if (m =3D=3D MATCH_YES) { - st =3D gfc_find_symtree (gfc_current_ns->sym_root, buffer); + gfc_symtree *st =3D NULL; + + /* First look for an intrinsic symbol. */ + isym =3D gfc_find_function (buffer); + if (!isym) + isym =3D gfc_find_subroutine (buffer); + /* If no intrinsic symbol found, search the current namespace. */ + if (!isym) + st =3D gfc_find_symtree (gfc_current_ns->sym_root, buffer); if (st) { sym =3D st->n.sym; @@ -2310,7 +2318,7 @@ gfc_match_oacc_routine (void) sym =3D NULL; } =20 - if (st =3D=3D NULL + if ((isym =3D=3D NULL && st =3D=3D NULL) || (sym && !sym->attr.external && !sym->attr.function @@ -2344,7 +2352,19 @@ gfc_match_oacc_routine (void) !=3D MATCH_YES)) return MATCH_ERROR; =20 - if (sym !=3D NULL) + if (isym !=3D NULL) + { + /* Diagnose any OpenACC 'routine' directive that doesn't match the + (implicit) one with a 'seq' clause. */ + if (c && (c->gang || c->worker || c->vector)) + { + gfc_error ("Intrinsic symbol specified in !$ACC ROUTINE ( NAME )" + " at %C marked with incompatible GANG, WORKER, or VECTOR" + " clause"); + goto cleanup; + } + } + else if (sym !=3D NULL) { n =3D gfc_get_oacc_routine_name (); n->sym =3D sym; @@ -2364,6 +2384,9 @@ gfc_match_oacc_routine (void) gfc_current_ns->proc_name->attr.oacc_routine_lop =3D gfc_oacc_routine_lop (c); } + else + /* Something has gone wrong, possibly a syntax error. */ + goto cleanup; =20 if (n) n->clauses =3D c; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 79de60324e3b..c45e7b7546a9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2019-02-28 Thomas Schwinge + Cesar Philippidis + + PR fortran/72741 + PR fortran/89433 + * gfortran.dg/goacc/routine-6.f90: Update + * gfortran.dg/goacc/routine-intrinsic-1.f: New file. + * gfortran.dg/goacc/routine-intrinsic-2.f: Likewise. + 2019-02-28 Jakub Jelinek =20 PR c/89521 diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-6.f90 b/gcc/testsuite/= gfortran.dg/goacc/routine-6.f90 index 10943cff3045..0201b8d1fee5 100644 --- a/gcc/testsuite/gfortran.dg/goacc/routine-6.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/routine-6.f90 @@ -1,3 +1,4 @@ +! Check for invalid syntax with !$ACC ROUTINE. =20 module m integer m1int @@ -45,6 +46,12 @@ program main !$acc end parallel end program main =20 +! Ensure that we recover from incomplete function definitions. + +integer function f1 ! { dg-error "Expected formal argument list in functio= n definition" } + !$acc routine ! { dg-error "Unclassifiable OpenACC directive" } +end function f1 ! { dg-error "Expecting END PROGRAM statement" } + subroutine subr1 (x)=20 !$acc routine integer, intent(inout) :: x diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-intrinsic-1.f b/gcc/te= stsuite/gfortran.dg/goacc/routine-intrinsic-1.f new file mode 100644 index 000000000000..5dab573a9966 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/routine-intrinsic-1.f @@ -0,0 +1,21 @@ +! Check for valid clauses with intrinsic symbols specified in OpenACC +! 'routine' directives. + + SUBROUTINE sub_1 + IMPLICIT NONE +!$ACC ROUTINE (ABORT) +!$ACC ROUTINE (ABORT) SEQ + + CALL ABORT + END SUBROUTINE sub_1 + + MODULE m_w_1 + IMPLICIT NONE +!$ACC ROUTINE (ABORT) SEQ +!$ACC ROUTINE (ABORT) + + CONTAINS + SUBROUTINE sub_2 + CALL ABORT + END SUBROUTINE sub_2 + END MODULE m_w_1 diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-intrinsic-2.f b/gcc/te= stsuite/gfortran.dg/goacc/routine-intrinsic-2.f new file mode 100644 index 000000000000..22524cc16451 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/routine-intrinsic-2.f @@ -0,0 +1,23 @@ +! Check for invalid clauses with intrinsic symbols specified in OpenACC +! 'routine' directives. + + SUBROUTINE sub_1 + IMPLICIT NONE +!$ACC ROUTINE (ABORT) WORKER ! { dg-error "Intrinsic symbol specified in \= \!\\\$ACC ROUTINE \\( NAME \\) at \\(1\\) marked with incompatible GANG, WO= RKER, or VECTOR clause" } +!$ACC ROUTINE (ABORT) GANG ! { dg-error "Intrinsic symbol specified in \\!= \\\$ACC ROUTINE \\( NAME \\) at \\(1\\) marked with incompatible GANG, WORK= ER, or VECTOR clause" } +!$ACC ROUTINE (ABORT) VECTOR ! { dg-error "Intrinsic symbol specified in \= \!\\\$ACC ROUTINE \\( NAME \\) at \\(1\\) marked with incompatible GANG, WO= RKER, or VECTOR clause" } + + CALL ABORT + END SUBROUTINE sub_1 + + MODULE m_w_1 + IMPLICIT NONE +!$ACC ROUTINE (ABORT) VECTOR ! { dg-error "Intrinsic symbol specified in \= \!\\\$ACC ROUTINE \\( NAME \\) at \\(1\\) marked with incompatible GANG, WO= RKER, or VECTOR clause" } +!$ACC ROUTINE (ABORT) WORKER ! { dg-error "Intrinsic symbol specified in \= \!\\\$ACC ROUTINE \\( NAME \\) at \\(1\\) marked with incompatible GANG, WO= RKER, or VECTOR clause" } +!$ACC ROUTINE (ABORT) GANG ! { dg-error "Intrinsic symbol specified in \\!= \\\$ACC ROUTINE \\( NAME \\) at \\(1\\) marked with incompatible GANG, WORK= ER, or VECTOR clause" } + + CONTAINS + SUBROUTINE sub_2 + CALL ABORT + END SUBROUTINE sub_2 + END MODULE m_w_1 --=20 2.17.1 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" Content-length: 658 -----BEGIN PGP SIGNATURE----- iQGzBAEBCgAdFiEEU9WEfWKGQazCmycCAKI7+41Q4XkFAlx4RawACgkQAKI7+41Q 4XlJlwv+MHGcfVMxihPuAMPe2QcvdG0StVz/KLT563UaKAKAVklEoVoXslv5u0TS ookxym5R4FLKtPRi7s4u+V4c4ZUN4FPVcnca4ihdiQzkvzMcg4SWQHkKZjstakxq K8lR8C4uBY5pUXa2xowlYjHFXvtR7Z1PYrKxsxPpYb8nySLUkKE6P2N2+rwyO+uy X0TFfIW0Dye8TMrF9wYgeAVDXvKXMneGQOpLsSqYB8hkio7lOjxcB035bL3c1leI GFRtbWptr2y7ok2pFZShW7lvEpJMwg1fmzFGnjej6oDeSseycAmm5u4SuzTYzWb0 w0AtWYyRfifdYCZcDk3zbB/m/rAb+auSov3rlm/YMwuBeewmmYWpUuNjwQseuvyZ +tnu7RTi4wnxW5P5fTWmxF/rooz11pZ1+OBXJFDNh7Cml5wjebj1KM+1GYNeLLmN 9KwdpiHLakorOqhY5OI7LUVm9xXMJlyTCn6H/aGQIHHtz0dppkhQ5u5B17ka/84c CYbPD0TN =c0Mu -----END PGP SIGNATURE----- --==-=-=--