public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tobias Burnus <burnus@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/omp/gcc-12] Fix one issue in OpenMP 'requires' directive diagnostics
Date: Fri,  8 Jul 2022 09:37:23 +0000 (GMT)	[thread overview]
Message-ID: <20220708093723.8AFDA3858293@sourceware.org> (raw)

https://gcc.gnu.org/g:860c76659f38a52b06099ab530de7a9b08fd65ac

commit 860c76659f38a52b06099ab530de7a9b08fd65ac
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Fri Jul 8 11:33:23 2022 +0200

    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) <LTO_symtab_edge>: 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.
    
    (cherry picked from commit faa0c328ee65f0d6d65d6e20181d26e336071919)

Diff:
---
 gcc/ChangeLog.omp                                   |  8 ++++++++
 gcc/lto-cgraph.cc                                   |  2 +-
 libgomp/ChangeLog.omp                               | 11 +++++++++++
 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 ++++++++
 8 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index 6b594307049..8296bc927ea 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,11 @@
+2022-07-08  Tobias Burnus  <tobias@codesourcery.com>
+
+	Backport from mainline:
+	2022-07-08  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* lto-cgraph.cc (input_offload_tables) <LTO_symtab_edge>: Correct
+	'fn2' computation.
+
 2022-07-07  Tobias Burnus  <tobias@codesourcery.com>
 
 	Backport from mainline:
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/ChangeLog.omp b/libgomp/ChangeLog.omp
index 91bf55fe7e1..fcd91098974 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,3 +1,14 @@
+2022-07-08  Tobias Burnus  <tobias@codesourcery.com>
+
+	Backport from mainline:
+	2022-07-08  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* 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.
+
 2022-07-07  Tobias Burnus  <tobias@codesourcery.com>
 
 	Backport from mainline:
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
+     <https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598011.html>):
+     { 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
+!   <https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598011.html>):
+!   { 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" }


                 reply	other threads:[~2022-07-08  9:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220708093723.8AFDA3858293@sourceware.org \
    --to=burnus@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).