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 C8F393858293 for ; Fri, 8 Jul 2022 06:59:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C8F393858293 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.92,254,1650960000"; d="scan'208,223";a="78511769" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 07 Jul 2022 22:59:39 -0800 IronPort-SDR: o+HDlNoGxxwV/gVQb4Aidr313Tdy/zAOku5I5PRcASU2nMaV7sTGTuKSxpnEPsw9zp01RKRUP4 +wU7v1H7hn5mbXFfuk2AhgWHDmavYQzWtN4smB2D0y7kSF/DSwsboplLu4h4ct5rQy5M9IWzCp iW3jZVXRZmzpuGPP2cYcgiHZVa9crRKDo+ocW0kMW5rkvoTrPyN3wyMOLbv188cuZKlgpBx9Rq MYgxXsdDtf26nY1mwngqBhY5hlSpSxcelam9aoq6cD75imduJTd0r44FeE9Fh5bVx4+BI/FvyI BcY= From: Thomas Schwinge To: Tobias Burnus , CC: Jakub Jelinek Subject: Re: Fix one issue in OpenMP 'requires' directive diagnostics (was: [Patch][v5] OpenMP: Move omp requires checks to libgomp) In-Reply-To: <6993a884-acb2-a0a0-7a2f-b448150ea8c3@codesourcery.com> References: <7f9c91c1-a479-f94f-ac14-1d6827ce671b@codesourcery.com> <5576fa00-0ddd-8046-17c1-d1cea82bdcf5@codesourcery.com> <77331328-4961-9dab-db58-b5b03daf218c@codesourcery.com> <16ca2aa4-7e73-cf9d-9482-dd59f5b0cdae@codesourcery.com> <4d42ab12-53bd-f564-25df-2e8c890f406a@codesourcery.com> <87h73t3vh1.fsf@euler.schwinge.homeip.net> <6993a884-acb2-a0a0-7a2f-b448150ea8c3@codesourcery.com> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/27.1 (x86_64-pc-linux-gnu) Date: Fri, 8 Jul 2022 08:59:31 +0200 Message-ID: <87r12w5bu4.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_MSPIKE_H2, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jul 2022 06:59:43 -0000 --=-=-= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi! On 2022-07-07T15:56:28+0200, Tobias Burnus wrote: > On 07.07.22 15:26, Thomas Schwinge wrote: >> On 2022-07-01T23:08:16+0200, Tobias Burnus >> wrote: >>> Updated version attached =E2=80=93 I hope I got everything right, but I= start to >>> get tired, I am not 100% sure. >> ..., and so the obligatory copy'n'past-o;-) crept in: > ... >>> + if (tmp_decl !=3D NULL_TREE) >>> + fn2 =3D IDENTIFIER_POINTER (DECL_NAME (requires_dec= l)); >>> + } >> ... here: tmp_decl' not 'requires_decl'. OK to push the attached >> "Fix one issue in OpenMP 'requires' directive diagnostics"? > Good that you spotted it and thanks for testing + fixing it! >> I'd even push that one "as obvious", but thought I'd ask whether you >> maybe have a quick idea about the XFAILs that I'm adding? (I'm otherwis= e >> not planning on resolving that issue at this time.) > > (This question relates to what's printed if there is no TRANSLATION_UNIT_= DECL.) > [...] Thanks for the explanation, makes sense. > Regarding the xfail: I think it is fine to have this xfail, but as it is > clear why inform points to /tmp/cc*.o, you could reword the TODO to > state why it goes wrong. Done: TODO We're currently not streaming location information for the OpenMP directives used in 'requires-7-aux.c', so we're not seeing the source f= ile name here (but a temporary '*.o' instead; for details, see ): { dg-note {requires-7-aux\.c' has 'unified_address'} {} { xfail *-*-* }= 0 } ..., but we may still verify that the rest of the diagnostic is correct= : { dg-note {' has 'unified_address'} {} { target *-*-* } 0 } With just that changed, I've pushed to master branch commit faa0c328ee65f0d6d65d6e20181d26e336071919 "Fix one issue in OpenMP 'requires' directive diagnostics", see attached. Gr=C3=BC=C3=9Fe Thomas ----------------- 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 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename="0001-Fix-one-issue-in-OpenMP-requires-directive-diagnosti.patch" >From faa0c328ee65f0d6d65d6e20181d26e336071919 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Thu, 7 Jul 2022 15:11:03 +0200 Subject: [PATCH] Fix one issue in OpenMP 'requires' directive diagnostics Fix-up for recent commit 683f11843974f0bdf42f79cdcbb0c2b43c7b81b0 "OpenMP: Move omp requires checks to libgomp". gcc/ * lto-cgraph.cc (input_offload_tables) : Correct 'fn2' computation. libgomp/ * testsuite/libgomp.c-c++-common/requires-1.c: Add 'dg-note's. * testsuite/libgomp.c-c++-common/requires-2.c: Likewise. * testsuite/libgomp.c-c++-common/requires-3.c: Likewise. * testsuite/libgomp.c-c++-common/requires-7.c: Likewise. * testsuite/libgomp.fortran/requires-1.f90: Likewise. --- gcc/lto-cgraph.cc | 2 +- libgomp/testsuite/libgomp.c-c++-common/requires-1.c | 4 +++- libgomp/testsuite/libgomp.c-c++-common/requires-2.c | 4 +++- libgomp/testsuite/libgomp.c-c++-common/requires-3.c | 4 +++- libgomp/testsuite/libgomp.c-c++-common/requires-7.c | 10 +++++++++- libgomp/testsuite/libgomp.fortran/requires-1.f90 | 8 ++++++++ 6 files changed, 27 insertions(+), 5 deletions(-) diff --git a/gcc/lto-cgraph.cc b/gcc/lto-cgraph.cc index 48629651e31..6d9c36ea8b6 100644 --- a/gcc/lto-cgraph.cc +++ b/gcc/lto-cgraph.cc @@ -1879,7 +1879,7 @@ input_offload_tables (bool do_force_output) && TREE_CODE (tmp_decl) != TRANSLATION_UNIT_DECL) tmp_decl = DECL_CONTEXT (tmp_decl); if (tmp_decl != NULL_TREE) - fn2 = IDENTIFIER_POINTER (DECL_NAME (requires_decl)); + fn2 = IDENTIFIER_POINTER (DECL_NAME (tmp_decl)); } char buf1[sizeof ("unified_address, unified_shared_memory, " diff --git a/libgomp/testsuite/libgomp.c-c++-common/requires-1.c b/libgomp/testsuite/libgomp.c-c++-common/requires-1.c index ab9a8ddfcde..31996f1ecf6 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/requires-1.c +++ b/libgomp/testsuite/libgomp.c-c++-common/requires-1.c @@ -20,5 +20,7 @@ main (void) return 0; } -/* { dg-error "OpenMP 'requires' directive with non-identical clauses in multiple compilation units: 'unified_shared_memory' vs. 'unified_address'" "" { target *-*-* } 0 } */ +/* { dg-error "OpenMP 'requires' directive with non-identical clauses in multiple compilation units: 'unified_shared_memory' vs. 'unified_address'" "" { target *-*-* } 0 } + { dg-note {requires-1\.c' has 'unified_shared_memory'} {} { target *-*-* } 0 } + { dg-note {requires-1-aux\.c' has 'unified_address'} {} { target *-*-* } 0 } */ /* { dg-excess-errors "Ignore messages like: errors during merging of translation units|mkoffload returned 1 exit status" } */ diff --git a/libgomp/testsuite/libgomp.c-c++-common/requires-2.c b/libgomp/testsuite/libgomp.c-c++-common/requires-2.c index be1830d0c46..b20e154b0c7 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/requires-2.c +++ b/libgomp/testsuite/libgomp.c-c++-common/requires-2.c @@ -21,5 +21,7 @@ main (void) return 0; } -/* { dg-error "OpenMP 'requires' directive with 'unified_shared_memory' specified only in some compilation units" "" { target *-*-* } 0 } */ +/* { dg-error "OpenMP 'requires' directive with 'unified_shared_memory' specified only in some compilation units" "" { target *-*-* } 0 } + { dg-note {requires-2\.c' has 'unified_shared_memory'} {} { target *-*-* } 0 } + { dg-note {but '[^']*requires-2-aux\.c' has not} {} { target *-*-* } 0 } */ /* { dg-excess-errors "Ignore messages like: errors during merging of translation units|mkoffload returned 1 exit status" } */ diff --git a/libgomp/testsuite/libgomp.c-c++-common/requires-3.c b/libgomp/testsuite/libgomp.c-c++-common/requires-3.c index 1c204c8a21e..a549a19ebbb 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/requires-3.c +++ b/libgomp/testsuite/libgomp.c-c++-common/requires-3.c @@ -20,5 +20,7 @@ main (void) return 0; } -/* { dg-error "OpenMP 'requires' directive with non-identical clauses in multiple compilation units: 'unified_address, unified_shared_memory' vs. 'unified_address'" "" { target *-*-* } 0 } */ +/* { dg-error "OpenMP 'requires' directive with non-identical clauses in multiple compilation units: 'unified_address, unified_shared_memory' vs. 'unified_address'" "" { target *-*-* } 0 } + { dg-note {requires-3\.c' has 'unified_address, unified_shared_memory'} {} { target *-*-* } 0 } + { dg-note {requires-3-aux\.c' has 'unified_address'} {} { target *-*-* } 0 } */ /* { dg-excess-errors "Ignore messages like: errors during merging of translation units|mkoffload returned 1 exit status" } */ diff --git a/libgomp/testsuite/libgomp.c-c++-common/requires-7.c b/libgomp/testsuite/libgomp.c-c++-common/requires-7.c index 7473aa62e08..63afcc92b9a 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/requires-7.c +++ b/libgomp/testsuite/libgomp.c-c++-common/requires-7.c @@ -20,5 +20,13 @@ main (void) return 0; } -/* { dg-error "OpenMP 'requires' directive with non-identical clauses in multiple compilation units: 'unified_shared_memory' vs. 'unified_address'" "" { target *-*-* } 0 } */ +/* { dg-error "OpenMP 'requires' directive with non-identical clauses in multiple compilation units: 'unified_shared_memory' vs. 'unified_address'" "" { target *-*-* } 0 } + { dg-note {requires-7\.c' has 'unified_shared_memory'} {} { target *-*-* } 0 } + TODO We're currently not streaming location information for the OpenMP + directives used in 'requires-7-aux.c', so we're not seeing the source file + name here (but a temporary '*.o' instead; for details, see + ): + { dg-note {requires-7-aux\.c' has 'unified_address'} {} { xfail *-*-* } 0 } + ..., but we may still verify that the rest of the diagnostic is correct: + { dg-note {' has 'unified_address'} {} { target *-*-* } 0 } */ /* { dg-excess-errors "Ignore messages like: errors during merging of translation units|mkoffload returned 1 exit status" } */ diff --git a/libgomp/testsuite/libgomp.fortran/requires-1.f90 b/libgomp/testsuite/libgomp.fortran/requires-1.f90 index e957b1b5918..9a0c33461f8 100644 --- a/libgomp/testsuite/libgomp.fortran/requires-1.f90 +++ b/libgomp/testsuite/libgomp.fortran/requires-1.f90 @@ -23,4 +23,12 @@ program main end ! { dg-error "OpenMP 'requires' directive with non-identical clauses in multiple compilation units: 'unified_shared_memory' vs. 'unified_address'" "" { target *-*-* } 0 } +! { dg-note {requires-1\.f90' has 'unified_shared_memory'} {} { target *-*-* } 0 } +! TODO We're currently not streaming location information for the OpenMP +! directives used in 'requires-7-aux.c', so we're not seeing the source file +! name here (but a temporary '*.o' instead; for details, see +! ): +! { dg-note {requires-1-aux\.f90' has 'unified_address'} {} { xfail *-*-* } 0 } +! ..., but we may still verify that the rest of the diagnostic is correct: +! { dg-note {' has 'unified_address'} {} { target *-*-* } 0 } ! { dg-excess-errors "Ignore messages like: errors during merging of translation units|mkoffload returned 1 exit status" } -- 2.35.1 --=-=-=--