]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix one issue in OpenMP 'requires' directive diagnostics
authorThomas Schwinge <thomas@codesourcery.com>
Thu, 7 Jul 2022 13:11:03 +0000 (15:11 +0200)
committerThomas Schwinge <thomas@codesourcery.com>
Fri, 8 Jul 2022 06:53:58 +0000 (08:53 +0200)
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.

gcc/lto-cgraph.cc
libgomp/testsuite/libgomp.c-c++-common/requires-1.c
libgomp/testsuite/libgomp.c-c++-common/requires-2.c
libgomp/testsuite/libgomp.c-c++-common/requires-3.c
libgomp/testsuite/libgomp.c-c++-common/requires-7.c
libgomp/testsuite/libgomp.fortran/requires-1.f90

index 48629651e3174df743a0d54967591bd6e2e09d84..6d9c36ea8b67f60ac66d0e2bf50b7f58d8a53732 100644 (file)
@@ -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, "
index ab9a8ddfcde2a3fe85a2c89f6810f5038c127da6..31996f1ecf657348f8cf25d97df8aac098ff3ee7 100644 (file)
@@ -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" } */
index be1830d0c46eef9c75a3385ba17705785c751faf..b20e154b0c70bc54fcd6e785cc3911392015c2b7 100644 (file)
@@ -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" } */
index 1c204c8a21e590c95b5e27743f08493356dba778..a549a19ebbbac9283e4437a09d92fae7b177dbfd 100644 (file)
@@ -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" } */
index 7473aa62e081fe4028cfecf87a591e9a01e37924..63afcc92b9a9988159aa3b6dce709868a93b2693 100644 (file)
@@ -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" } */
index e957b1b5918a649a86e2a2a089d99ff4ad196e58..9a0c33461f81c76672127b6e0333383810e0fb19 100644 (file)
@@ -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" }