From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id C3F803858D1E; Tue, 2 May 2023 10:29:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C3F803858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.99,244,1677571200"; d="scan'208";a="4603413" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 02 May 2023 02:29:29 -0800 IronPort-SDR: 3F5FGed1MD9TiC6Es8n6lN9W70HuVk6j4oJI9heWgugjXV72kHyLxvZDzoBypQULw20hyssGoO jizVhbXna99tJCeo8s1agTNnrg/eahw1mtU+cF6qvFZQX2odKtSz1jNFN0cDEjOsWZHULVqb1L BupnOPeG5gy1QAuF1aMc+/JK9zZdsiUYZwxr4jcP0IALQbM3IKmq3mchb8C1xR3I8FycFC2SKv /HGCp4krNJiJPQrrHuHntbMjqZe9J7tL4XFXrAY8udMAYzo2TxXUzEvjWyI3WT2wkyBZnm3W5A sNQ= Message-ID: <0af16eab-5b25-b167-ad4b-54612825d0ca@codesourcery.com> Date: Tue, 2 May 2023 12:29:22 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: Re: [PATCH] OpenACC: Further attach/detach clause fixes for Fortran [PR109622] To: Julian Brown , CC: , , References: <20230429105741.108576-1-julian@codesourcery.com> Content-Language: en-US From: Tobias Burnus In-Reply-To: <20230429105741.108576-1-julian@codesourcery.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) To svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,KAM_SHORT,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 29.04.23 12:57, Julian Brown wrote: > This patch moves several tests introduced by the following patch: > > https://gcc.gnu.org/pipermail/gcc-patches/2023-April/616939.html I believe you intent this as git log entry. Can you add ... commit r14-325-gcacf65d74463600815773255e8b82b4043432bd7 as this makes looking at the git history easier. > into the proper location for OpenACC testing (thanks to Thomas for > spotting my mistake!), and also fixes a few additional problems -- > missing diagnostics for non-pointer attaches, and a case where a pointer > was incorrectly dereferenced. Tests are also adjusted for vector-length > warnings on nvidia accelerators. > > Tested with offloading to nvptx. OK? > > 2023-04-29 Julian Brown > > PR fortran/109622 > > gcc/fortran/ > * trans-openmp.cc (gfc_trans_omp_clauses): Add diagnostic for > non-pointer/non-allocatable attach/detach. Remove dereference for > pointer-to-scalar derived type component attach/detach. In general, we prefer resolution-time diagnostic to tree-translation diagno= stic, unless there is a good reason to do the latter. At a glance, it should be even sufficient to have a single diagnostic instead of two when placed into openmp.cc. Search for lastref in resolve_omp_clauses; I think it should do, but otherwise something like: symbol_attr attr =3D gfc_expr_attr(e); if (attr.pointer || attr.allocatable) should work. You currently have: > @@ -3430,6 +3432,13 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp= _clauses *clauses, > =3D TYPE_SIZE_UNIT (gfc_charlen_type_node); > } > } > + else if (openacc > + && (n->u.map_op =3D=3D OMP_MAP_ATTACH > + || n->u.map_op =3D=3D OMP_MAP_DETACH)) > + gfc_error ("%qs clause argument not pointer or " > + "allocatable at %L", > + (n->u.map_op =3D=3D OMP_MAP_ATTACH) > + ? "attach" : "detach", &where); Additionally, I think we we usually have wording like: 'must be ALLOCATABLE= or a POINTER'. (Which avoids also the question whether 'neither' instead of 'not should be= used and/besides to 'nor' instead of 'or'.) Additionally, I think there should be a also an error for: integer :: a !$acc enter data attach(a) end (Well, in that case, just looking at n->expr won't work, but also n->sym ne= eds to be handled for list =3D=3D OMP_LIST_MAP && n->u.map_op =3D=3D OMP_MAP_(DE)ATTA= CH. The other changes look fine. Thanks! Tobias ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 201= , 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaf= t: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955