From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id AE18A383EB16; Thu, 8 Dec 2022 10:22:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AE18A383EB16 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.96,227,1665475200"; d="scan'208";a="89413099" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa2.mentor.iphmx.com with ESMTP; 08 Dec 2022 02:22:26 -0800 IronPort-SDR: 9fzmzhf9fJzJIwq3EobnjurDUc98zQImMtgHlhlWitTQelyCqkCkzuscCtb4xUnMmVK32buwHo EtjdrIvbhbQL1XL0F2bbX2UgU2McXBhCnQJVYVQXTOWxIEmonK8mfR6rjSYeuk+2VyjDD+LIH2 g5Aqb7zL9nCniKORPsPMXPDyQroX15Yq2TIDQTeoDu0BiP2B1GktmYHHLfImIyRRcdFlwxJw5j cbTIjxF3MXlVRgBrcT0mKEv7+PvJBX1/Wmu1VPlaPEAEE6Dn7wV/8GpOewHouApcXC/7sx64Xv tzg= Message-ID: <55d31032-a0aa-0411-157e-deba6fe132f9@codesourcery.com> Date: Thu, 8 Dec 2022 11:22:09 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH 1/2] OpenMP/Fortran: Combined directives with map/firstprivate of same symbol Content-Language: en-US To: Julian Brown CC: , Jakub Jelinek , References: <20221020161414.7430-1-julian@codesourcery.com> <20221207190903.78a6b37f@squid.athome> From: Tobias Burnus In-Reply-To: <20221207190903.78a6b37f@squid.athome> 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-13.mgc.mentorg.com (139.181.222.13) To svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,NICE_REPLY_A,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,TXREP 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 07.12.22 20:09, Julian Brown wrote: > On Wed, 26 Oct 2022 12:39:39 +0200 > Tobias Burnus wrote: >> The ICE seems to be because gcc/fortran/trans-openmp.cc's >> gfc_split_omp_clauses mishandles this as the dump shows the following: >> >> #pragma omp target firstprivate(a) map(tofrom:a) >> #pragma omp parallel firstprivate(a) >> >> In contrast, for the C testcase: >> >> #pragma omp target parallel for simd map(x) firstprivate(x) >> >> the dump is as follows, which seems to be sensible: >> >> #pragma omp target map(tofrom:x) >> #pragma omp parallel firstprivate(x) > This patch fixes a case where a combined directive (e.g. "!$omp target > parallel ...") contains both a map and a firstprivate clause for the > same variable. When the combined directive is split into two nested > directives, the outer "target" gets the "map" clause, and the inner > "parallel" gets the "firstprivate" clause, like so: ... > This is not a recent regression, but appears to fix a long-standing ICE. ... > gcc/fortran/ > * trans-openmp.cc (gfc_add_firstprivate_if_unmapped): New functi= on. > (gfc_split_omp_clauses): Call above. > > libgomp/ > * testsuite/libgomp.fortran/combined-directive-splitting-1.f90: = New > test. LGTM =E2=80=93 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