This patch implements the Fortran deprecations for OpenMP 5.2, save those
either not currently available in mainline or undeprecated in OpenMP 6.0.
Deprecations use the warning introduced in patch 1/4, Wdeprecated-openmp.
It modifies the test suite accordingly.

Built/tested x86_64-pc-linux-gnu.
From 87e0d5c3e2c7416433a1c7c2992839ffa4d0e988 Mon Sep 17 00:00:00 2001
From: supers1ngular <[email protected]>
Date: Wed, 19 Nov 2025 16:09:01 -0800
Subject: [PATCH] [PATCH 3/4] openmp: Bump Version from 4.5 to 5.2

Implements the OpenMP 5.2 Fortran deprecations. Uses the warning
established in patch 1/4, -Wdeprecated-openmp, for said deprecations.
Similarly, we do not implement the deprecation for 'uses_allocators'
since it is not yet in mainline, nor do we deprecate the relaxing of
constraints for the interop construct since it is not a deprecation.
Additionally implements the Fortran-specific deprecation for
executable allocate directives, and adds a new test.

gcc/fortran/ChangeLog:

	* openmp.cc (gfc_match_omp_clause_reduction): Implement
	deprecation of the '-' operator for reductions.
	(gfc_match_omp_clauses): Implement deprecation of list items
	as arguments to modifiers. Additionally deprecate not using
	comma separators for the 'map' clause. Fix spacing of a warning.
	(gfc_match_omp_declare_target): Deprecate 'to' clause in declare
	target.
	(match_omp_metadirective): Deprecate 'default' clause on
	metadirectives.
	(resolve_omp_clauses): Deprecate executable allocate
	directives. Deprecate 'sink', 'source' modifiers with 'depend'
	clause.

libgomp/ChangeLog:

	* testsuite/libgomp.fortran/allocate-8a.f90: Suppress warnings.
	* testsuite/libgomp.fortran/allocators-1.f90: Ditto.
	* testsuite/libgomp.fortran/allocators-2.f90: Ditto.
	* testsuite/libgomp.fortran/allocators-4.f90: Ditto.
	* testsuite/libgomp.fortran/declare-target-1.f90: Ditto.
	* testsuite/libgomp.fortran/declare-target-2.f90: Ditto.
	* testsuite/libgomp.fortran/declare-target-indirect-1.f90: Ditto.
	* testsuite/libgomp.fortran/declare-target-indirect-2.f90: Ditto.
	* testsuite/libgomp.fortran/doacross1.f90: Ditto.
	* testsuite/libgomp.fortran/doacross2.f90: Ditto.
	* testsuite/libgomp.fortran/doacross3.f90: Ditto.
	* testsuite/libgomp.fortran/map-alloc-ptr-2.f90: Ditto.
	* testsuite/libgomp.fortran/pr84418-1.f90: Ditto.
	* testsuite/libgomp.fortran/pr84418-2.f90: Ditto.
	* testsuite/libgomp.fortran/reduction1.f90: Ditto.
	* testsuite/libgomp.fortran/udr11.f90: Ditto.

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/allocate-14.f90: Ditto.
	* gfortran.dg/gomp/allocate-16.f90: Ditto.
	* gfortran.dg/gomp/allocate-5.f90: Ditto.
	* gfortran.dg/gomp/allocate-6.f90: Ditto.
	* gfortran.dg/gomp/allocate-7.f90: Ditto.
	* gfortran.dg/gomp/allocators-3.f90: Ditto.
	* gfortran.dg/gomp/declare-simd-2.f90: Ditto.
	* gfortran.dg/gomp/declare-simd-6.f90: Ditto.
	* gfortran.dg/gomp/declare-target-1.f90: Ditto.
	* gfortran.dg/gomp/declare-target-2.f90: Ditto.
	* gfortran.dg/gomp/declare-target-4.f90: Ditto.
	* gfortran.dg/gomp/declare-target-5.f90: Ditto.
	* gfortran.dg/gomp/declare-target-indirect-1.f90: Ditto.
	* gfortran.dg/gomp/declare-target-indirect-2.f90: Ditto.
	* gfortran.dg/gomp/declare-variant-10.f90: Ditto.
	* gfortran.dg/gomp/declare-variant-8.f90: Ditto.
	* gfortran.dg/gomp/implicit-save.f90: Ditto.
	* gfortran.dg/gomp/linear-1.f90: Ditto.
	* gfortran.dg/gomp/linear-2.f90: Ditto.
	* gfortran.dg/gomp/linear-3.f90: Ditto.
	* gfortran.dg/gomp/linear-4.f90: Ditto.
	* gfortran.dg/gomp/linear-6.f90: Ditto.
	* gfortran.dg/gomp/map-12.f90: Ditto.
	* gfortran.dg/gomp/map-6.f90: Ditto.
	* gfortran.dg/gomp/map-7.f90: Ditto.
	* gfortran.dg/gomp/map-8.f90: Ditto.
	* gfortran.dg/gomp/order-8.f90: Ditto.
	* gfortran.dg/gomp/pr83977.f90: Ditto.
	* gfortran.dg/gomp/reduction1.f90: Ditto.
	* gfortran.dg/gomp/schedule-modifiers-2.f90: Ditto.
	* gfortran.dg/gomp/workshare-reduction-55.f90: Ditto.
	* gfortran.dg/gomp/workshare-reduction-56.f90: Ditto.
	* gfortran.dg/gomp/workshare-reduction-57.f90: Ditto.
	* gfortran.dg/gomp/workshare-reduction-58.f90: Ditto.
	* gfortran.dg/gomp/52-deps.f90: New test.

---
 gcc/fortran/openmp.cc                         | 76 +++++++++++++++----
 gcc/testsuite/gfortran.dg/gomp/52-deps.f90    | 44 +++++++++++
 .../gfortran.dg/gomp/allocate-14.f90          |  6 +-
 .../gfortran.dg/gomp/allocate-16.f90          |  3 +-
 gcc/testsuite/gfortran.dg/gomp/allocate-5.f90 |  1 +
 gcc/testsuite/gfortran.dg/gomp/allocate-6.f90 |  1 +
 gcc/testsuite/gfortran.dg/gomp/allocate-7.f90 |  1 +
 .../gfortran.dg/gomp/allocators-3.f90         |  1 +
 .../gfortran.dg/gomp/declare-simd-2.f90       |  2 +-
 .../gfortran.dg/gomp/declare-simd-6.f90       |  2 +-
 .../gfortran.dg/gomp/declare-target-1.f90     |  2 +-
 .../gfortran.dg/gomp/declare-target-2.f90     |  2 +-
 .../gfortran.dg/gomp/declare-target-4.f90     |  2 +-
 .../gfortran.dg/gomp/declare-target-5.f90     |  1 +
 .../gomp/declare-target-indirect-1.f90        |  2 +-
 .../gomp/declare-target-indirect-2.f90        |  2 +-
 .../gfortran.dg/gomp/declare-variant-10.f90   |  2 +-
 .../gfortran.dg/gomp/declare-variant-8.f90    |  2 +-
 .../gfortran.dg/gomp/implicit-save.f90        |  4 +-
 gcc/testsuite/gfortran.dg/gomp/linear-1.f90   |  1 +
 gcc/testsuite/gfortran.dg/gomp/linear-2.f90   |  2 +-
 gcc/testsuite/gfortran.dg/gomp/linear-3.f90   |  2 +-
 gcc/testsuite/gfortran.dg/gomp/linear-4.f90   |  2 +-
 gcc/testsuite/gfortran.dg/gomp/linear-6.f90   |  2 +-
 gcc/testsuite/gfortran.dg/gomp/map-12.f90     |  2 +-
 gcc/testsuite/gfortran.dg/gomp/map-6.f90      |  2 +-
 gcc/testsuite/gfortran.dg/gomp/map-7.f90      |  2 +-
 gcc/testsuite/gfortran.dg/gomp/map-8.f90      |  1 +
 gcc/testsuite/gfortran.dg/gomp/order-8.f90    |  1 +
 gcc/testsuite/gfortran.dg/gomp/pr83977.f90    |  2 +-
 gcc/testsuite/gfortran.dg/gomp/reduction1.f90 |  2 +-
 .../gfortran.dg/gomp/schedule-modifiers-2.f90 |  2 +-
 .../gomp/workshare-reduction-55.f90           |  1 +
 .../gomp/workshare-reduction-56.f90           |  1 +
 .../gomp/workshare-reduction-57.f90           |  1 +
 .../gomp/workshare-reduction-58.f90           |  1 +
 .../testsuite/libgomp.fortran/allocate-8a.f90 |  1 +
 .../libgomp.fortran/allocators-1.f90          |  3 +-
 .../libgomp.fortran/allocators-2.f90          |  1 +
 .../libgomp.fortran/allocators-4.f90          |  1 +
 .../libgomp.fortran/declare-target-1.f90      |  2 +-
 .../libgomp.fortran/declare-target-2.f90      |  1 -
 .../declare-target-indirect-1.f90             |  2 +-
 .../declare-target-indirect-2.f90             |  2 +-
 .../testsuite/libgomp.fortran/doacross1.f90   |  2 +-
 .../testsuite/libgomp.fortran/doacross2.f90   |  2 +-
 .../testsuite/libgomp.fortran/doacross3.f90   |  2 +-
 .../libgomp.fortran/map-alloc-ptr-2.f90       |  2 +-
 .../testsuite/libgomp.fortran/pr84418-1.f90   |  2 +-
 .../testsuite/libgomp.fortran/pr84418-2.f90   |  4 +-
 .../testsuite/libgomp.fortran/reduction1.f90  |  2 +-
 libgomp/testsuite/libgomp.fortran/udr11.f90   |  2 +-
 52 files changed, 160 insertions(+), 54 deletions(-)
 create mode 100644 gcc/testsuite/gfortran.dg/gomp/52-deps.f90

diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc
index 6af1743b660..cfaeff0fb54 100644
--- a/gcc/fortran/openmp.cc
+++ b/gcc/fortran/openmp.cc
@@ -1490,7 +1490,11 @@ gfc_match_omp_clause_reduction (char pc, gfc_omp_clauses *c, bool openacc,
   else if (gfc_match_char ('*') == MATCH_YES)
     rop = OMP_REDUCTION_TIMES;
   else if (gfc_match_char ('-') == MATCH_YES)
-    rop = OMP_REDUCTION_MINUS;
+    {
+      gfc_warning (OPT_Wdeprecated_openmp, "%<-%> operator at %C "
+	"for reductions deprecated in OpenMP 5.2");
+      rop = OMP_REDUCTION_MINUS;
+    }
   else if (gfc_match (".and.") == MATCH_YES)
     rop = OMP_REDUCTION_AND;
   else if (gfc_match (".or.") == MATCH_YES)
@@ -2903,6 +2907,12 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
 				 "at %C");
 		      goto error;
 		    }
+		  if (is_depend)
+		    {
+		      gfc_warning (OPT_Wdeprecated_openmp, "%<source%> "
+			"modifier with %<depend%> clause at %L deprecated "
+			"since OpenMP 5.2, use with %<doacross%>", &old_loc);
+		    }
 		  c->doacross_source = true;
 		  c->depend_source = is_depend;
 		  continue;
@@ -2926,6 +2936,13 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
 				 "at %C");
 		      goto error;
 		    }
+		  if (is_depend)
+		    {
+		      gfc_warning (OPT_Wdeprecated_openmp, "%<sink%> "
+			"modifier with %<depend%> clause at %L "
+			"deprecated since OpenMP 5.2, use with %<doacross%>",
+			&old_loc);
+		    }
 		  m = gfc_match_omp_doacross_sink (&c->lists[OMP_LIST_DEPEND],
 						   is_depend);
 		  if (m == MATCH_YES)
@@ -3385,6 +3402,7 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
 	      bool old_linear_modifier = false;
 	      gfc_omp_linear_op linear_op = OMP_LINEAR_DEFAULT;
 	      gfc_expr *step = NULL;
+	      locus saved_loc = gfc_current_locus;
 
 	      if (gfc_match_omp_variable_list (" ref (",
 					       &c->lists[OMP_LIST_LINEAR],
@@ -3420,6 +3438,13 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
 		  gfc_current_locus = old_loc;
 		  break;
 		}
+	      if (old_linear_modifier)
+		{
+		  gfc_warning (OPT_Wdeprecated_openmp,
+		    "Specification of the list items as arguments to the "
+		    "modifiers at %L is deprecated since OpenMP 5.2",
+		    &saved_loc);
+		}
 	      if (linear_op != OMP_LINEAR_DEFAULT)
 		{
 		  if (gfc_match (" :") == MATCH_YES)
@@ -3600,7 +3625,13 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
 		    }
 		  else
 		    break;
-		  gfc_match (", ");
+		  if (gfc_match (", ") != MATCH_YES)
+		    {
+		      gfc_warning (OPT_Wdeprecated_openmp,
+			"The specification of modifiers without comma "
+			"separators for the %<map%> clause at %C has "
+			"been deprecated since OpenMP 5.2");
+		    }
 		}
 
 	      gfc_omp_map_op map_op = OMP_MAP_TOFROM;
@@ -3996,9 +4027,9 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
 		c->proc_bind = OMP_PROC_BIND_PRIMARY;
 	      else if (gfc_match ("master )") == MATCH_YES)
 	      {
-		  gfc_warning (OPT_Wdeprecated_openmp, "%<master%> affinity "
-		      "policy at %C deprecated since OpenMP 5.1, use "
-		      "%<primary%>");
+		gfc_warning (OPT_Wdeprecated_openmp, "%<master%> affinity "
+		  "policy at %L deprecated since OpenMP 5.1, use "
+		  "%<primary%>", &old_loc);
 		c->proc_bind = OMP_PROC_BIND_MASTER;
 	      }
 	      else if (gfc_match ("spread )") == MATCH_YES)
@@ -4263,7 +4294,12 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
 	      if (m == MATCH_ERROR)
 		goto error;
 	      if (m == MATCH_YES)
-		continue;
+		{
+		  gfc_warning (OPT_Wdeprecated_openmp, "%<to%> clause with "
+		    "%<declare target%> at %L deprecated since OpenMP 5.2, "
+		    "use %<enter%>", &old_loc);
+		  continue;
+		}
 	    }
 	  else if ((mask & OMP_CLAUSE_TO)
 		   && gfc_match_motion_var_list ("to (", &c->lists[OMP_LIST_TO],
@@ -6126,7 +6162,6 @@ gfc_match_omp_declare_target (void)
 	n->sym->mark = 0;
       else if (n->u.common->head)
 	n->u.common->head->mark = 0;
-
   for (size_t listn = 0; listn < ARRAY_SIZE (to_enter_link_lists)
 			 && (list = to_enter_link_lists[listn], true); ++listn)
     for (n = c->lists[list]; n; n = n->next)
@@ -6973,17 +7008,21 @@ match_omp_metadirective (bool begin_p)
 
       locus variant_locus = gfc_current_locus;
 
-      if (gfc_match (" default ( ") == MATCH_YES)
-	default_p = true;
-      else if (gfc_match (" otherwise ( ") == MATCH_YES)
+      if (gfc_match ("default ( ") == MATCH_YES)
+	{
+	  default_p = true;
+	  gfc_warning (OPT_Wdeprecated_openmp,
+	    "%<default%> clause with metadirective at %L "
+	    "deprecated since OpenMP 5.2", &variant_locus);
+	}
+      else if (gfc_match ("otherwise ( ") == MATCH_YES)
 	default_p = true;
-      else if (gfc_match (" when ( ") != MATCH_YES)
+      else if (gfc_match ("when ( ") != MATCH_YES)
 	{
 	  gfc_error ("expected %<when%>, %<otherwise%>, or %<default%> at %C");
 	  gfc_current_locus = old_loc;
 	  return MATCH_ERROR;
 	}
-
       if (default_p && default_seen)
 	{
 	  gfc_error ("too many %<otherwise%> or %<default%> clauses "
@@ -7005,8 +7044,7 @@ match_omp_metadirective (bool begin_p)
 	      != MATCH_YES)
 	    return MATCH_ERROR;
 
-	  if (gfc_match (" : ") != MATCH_YES)
-	    {
+	  if (gfc_match (" : ") != MATCH_YES) {
 	      gfc_error ("expected %<:%> at %C");
 	      gfc_current_locus = old_loc;
 	      return MATCH_ERROR;
@@ -9196,6 +9234,14 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
 	  && code->block->next
 	  && code->block->next->op == EXEC_ALLOCATE)
 	{
+	  if (code->op == EXEC_OMP_ALLOCATE)
+	    {
+	      gfc_warning (OPT_Wdeprecated_openmp,
+		"The use of one or more %<allocate%> directives with "
+		"an associated %<allocate%> statement at %L is "
+		"deprecated since OpenMP 5.2, use an %<allocators%> "
+		"directive", &code->loc);
+	    }
 	  gfc_alloc *a;
 	  gfc_omp_namelist *n_null = NULL;
 	  bool missing_allocator = false;
@@ -9218,7 +9264,7 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
 			   n->sym->name, &n->where);
 	      for (a = code->block->next->ext.alloc.list; a; a = a->next)
 		if (a->expr->expr_type == EXPR_VARIABLE
-		    && a->expr->symtree->n.sym == n->sym)
+		  && a->expr->symtree->n.sym == n->sym)
 		  {
 		    gfc_ref *ref;
 		    for (ref = a->expr->ref; ref; ref = ref->next)
diff --git a/gcc/testsuite/gfortran.dg/gomp/52-deps.f90 b/gcc/testsuite/gfortran.dg/gomp/52-deps.f90
new file mode 100644
index 00000000000..9cb8233a191
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/52-deps.f90
@@ -0,0 +1,44 @@
+! { dg-error ".* at \\(1\\) requires '-fopenmp-allocators'" "" { target *-*-* } 24 }
+! { dg-warning "All files that might deallocate such a variable must be compiled with '-fopenmp-allocators'" "" { target *-*-* } 24 }
+program test_deprecations
+  integer :: i
+  integer :: j
+  integer, allocatable :: a(:)
+  integer :: x(10)
+  integer :: y, z
+
+  ! { dg-warning "'to' clause with 'declare target' at \\(1\\) deprecated since OpenMP 5.2, use 'enter' \\\[-Wdeprecated-openmp\\\]" "" { target *-*-* } 11 }
+  !$omp declare target to(i)
+  !$omp do ordered(1)
+    do i = 1,10
+      ! { dg-warning "'source' modifier with 'depend' clause at \\(1\\) deprecated since OpenMP 5.2, use with 'doacross' \\\[-Wdeprecated-openmp\\\]" "" { target *-*-* } 15 }
+      !$omp ordered depend(source)
+        j = i
+      ! { dg-warning "'sink' modifier with 'depend' clause at \\(1\\) deprecated since OpenMP 5.2, use with 'doacross' \\\[-Wdeprecated-openmp\\\]" "" { target *-*-* } 18 }
+      !$omp ordered depend(sink : i)
+        j = i
+    end do
+  !$omp end do
+
+  ! { dg-warning "The use of one or more 'allocate' directives with an associated 'allocate' statement at \\(1\\) is deprecated since OpenMP 5.2, use an 'allocators' directive \\\[-Wdeprecated-openmp\\\]" "" { target *-*-* } 24 }
+  !$omp allocate(a)
+    allocate(a(100))
+    do i = 1,100
+      a(i) = i
+    end do
+    deallocate(a)
+
+
+  ! { dg-warning "The specification of modifiers without comma separators for the 'map' clause at \\(1\\) has been deprecated since OpenMP 5.2 \\\[-Wdeprecated-openmp\\\]" "" { target *-*-* } 33 }
+  !$omp target map(close to: x)
+    x = 1
+  !$omp end target
+
+  z = 1
+  ! { dg-warning "'-' operator at \\(1\\) for reductions deprecated in OpenMP 5.2 \\\[-Wdeprecated-openmp\\\]" "" { target *-*-* } 39 }
+  !$omp parallel do reduction(-:z)
+  do y = 1,10
+      z = z - y
+  end do
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/gomp/allocate-14.f90 b/gcc/testsuite/gfortran.dg/gomp/allocate-14.f90
index 4db950f90a7..77738344cea 100644
--- a/gcc/testsuite/gfortran.dg/gomp/allocate-14.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/allocate-14.f90
@@ -1,5 +1,5 @@
 ! { dg-additional-options "-fcoarray=single -fcray-pointer" }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
 module m
 use iso_c_binding
 integer, parameter :: omp_allocator_handle_kind = c_intptr_t
@@ -38,7 +38,7 @@ subroutine coarrays(x)
   !$omp allocate(z) ! { dg-error "18:Unexpected coarray 'z' in 'allocate' at .1." }
     allocate(z(5)[*])
   x = 5
-end 
+end
 
 
 integer function f() result(res)
@@ -114,7 +114,7 @@ subroutine coarray_3
   integer :: x
   integer, allocatable :: a, b, c[:], d
   x = 5 ! executable stmt
-  !$omp allocators allocate(align(16): a,b) allocate(align(32) : d) 
+  !$omp allocators allocate(align(16): a,b) allocate(align(32) : d)
   allocate(a,b,c[*],d)  ! OK - Fortran allocator used for 'C'
 end
 
diff --git a/gcc/testsuite/gfortran.dg/gomp/allocate-16.f90 b/gcc/testsuite/gfortran.dg/gomp/allocate-16.f90
index 6c203e02d57..6bba4536e4b 100644
--- a/gcc/testsuite/gfortran.dg/gomp/allocate-16.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/allocate-16.f90
@@ -1,3 +1,4 @@
+! { dg-additional-options "-Wno-deprecated-openmp" }
 integer, pointer :: ptr
 
 !$omp flush
@@ -5,6 +6,6 @@ integer, pointer :: ptr
 allocate(ptr)
 end
 
-! { dg-error "'!.OMP ALLOCATE' at .1. requires '-fopenmp-allocators'" "" { target *-*-* } 4 }
+! { dg-error "'!$OMP ALLOCATE' at .1. requires '-fopenmp-allocators'" "" { target *-*-* } 4 }
 ! { dg-warning "All files that might deallocate such a variable must be compiled with '-fopenmp-allocators'" "" { target *-*-* } 4 }
 ! { dg-note "This includes explicit DEALLOCATE, reallocation on intrinsic assignment, INTENT\\(OUT\\) for allocatable dummy arguments, and reallocation of allocatable components allocated with an OpenMP allocator" "" { target *-*-* } 0 }
diff --git a/gcc/testsuite/gfortran.dg/gomp/allocate-5.f90 b/gcc/testsuite/gfortran.dg/gomp/allocate-5.f90
index 28369ae876b..3e1f9a07028 100644
--- a/gcc/testsuite/gfortran.dg/gomp/allocate-5.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/allocate-5.f90
@@ -1,4 +1,5 @@
 ! { dg-additional-options "-fopenmp-allocators" }
+! { dg-additional-options "-Wno-deprecated-openmp" }
 module my_omp_lib
   use iso_c_binding, only: c_intptr_t
   !use omp_lib
diff --git a/gcc/testsuite/gfortran.dg/gomp/allocate-6.f90 b/gcc/testsuite/gfortran.dg/gomp/allocate-6.f90
index 063431d3582..7b7d4fd4645 100644
--- a/gcc/testsuite/gfortran.dg/gomp/allocate-6.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/allocate-6.f90
@@ -1,3 +1,4 @@
+! { dg-additional-options "-Wno-deprecated-openmp" }
 module my_omp_lib
   use iso_c_binding, only: c_intptr_t
   !use omp_lib
diff --git a/gcc/testsuite/gfortran.dg/gomp/allocate-7.f90 b/gcc/testsuite/gfortran.dg/gomp/allocate-7.f90
index ab85e327795..6feef5d0177 100644
--- a/gcc/testsuite/gfortran.dg/gomp/allocate-7.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/allocate-7.f90
@@ -1,4 +1,5 @@
 ! { dg-additional-options "-fmax-errors=1000" }
+! { dg-additional-options "-Wno-deprecated-openmp" }
 module my_omp_lib
   use iso_c_binding, only: c_intptr_t
   !use omp_lib
diff --git a/gcc/testsuite/gfortran.dg/gomp/allocators-3.f90 b/gcc/testsuite/gfortran.dg/gomp/allocators-3.f90
index d0e31ee8727..7cc43db735f 100644
--- a/gcc/testsuite/gfortran.dg/gomp/allocators-3.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/allocators-3.f90
@@ -1,3 +1,4 @@
+! { dg-additional-options "-Wno-deprecated-openmp" }
 subroutine f
   integer, allocatable :: A1, A2, B(:), C
   !$omp declare target
diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-simd-2.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-simd-2.f90
index 8f76774fd6e..261bba3bea0 100644
--- a/gcc/testsuite/gfortran.dg/gomp/declare-simd-2.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/declare-simd-2.f90
@@ -1,5 +1,5 @@
 ! { dg-do compile }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
 function f1 (a, b, c, d, e, f)
   integer, value :: a, b, c
   integer :: d, e, f, f1
diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-simd-6.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-simd-6.f90
index 83f2c0ab7cb..1f639748315 100644
--- a/gcc/testsuite/gfortran.dg/gomp/declare-simd-6.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/declare-simd-6.f90
@@ -1,6 +1,6 @@
 ! { dg-do compile }
 ! { dg-additional-options "-fdump-tree-gimple" }
-!
+! { dg-additional-options "-Wno-deprecated-openmp" }
 ! PR fortran/106566
 !
 ! { dg-final { scan-tree-dump-times "__attribute__\\(\\(omp declare simd \\(linear\\(ref\\(0\\):4\\) simdlen\\(8\\)\\)\\)\\)" 2 "gimple" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-target-1.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-target-1.f90
index bf64e72d082..a02bb427f4f 100644
--- a/gcc/testsuite/gfortran.dg/gomp/declare-target-1.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/declare-target-1.f90
@@ -1,5 +1,5 @@
 ! { dg-do compile }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
 module declare_target_1
   !$omp declare target to (var_1, var_4) link (var_2, var_3) &
   !$omp & link (var_5) to (var_6)
diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-target-2.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-target-2.f90
index 93075fb147e..aa3720b1818 100644
--- a/gcc/testsuite/gfortran.dg/gomp/declare-target-2.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/declare-target-2.f90
@@ -1,5 +1,5 @@
 ! { dg-do compile }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
 module declare_target_2
   !$omp declare target to (a) link (a)	! { dg-error "mentioned multiple times in clauses of the same OMP DECLARE TARGET directive" }
   !$omp declare target (b)
diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-target-4.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-target-4.f90
index 55534d8fe99..4714193d0b8 100644
--- a/gcc/testsuite/gfortran.dg/gomp/declare-target-4.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/declare-target-4.f90
@@ -1,6 +1,6 @@
 ! { dg-do compile }
 ! { dg-additional-options "-fdump-tree-original" }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
 subroutine f1
   !$omp declare target device_type (any)  ! { dg-warning "OMP DECLARE TARGET directive at .1. with only DEVICE_TYPE or INDIRECT clauses is ignored" }
 end subroutine
diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-target-5.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-target-5.f90
index 76687d476d5..a6870cfaeac 100644
--- a/gcc/testsuite/gfortran.dg/gomp/declare-target-5.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/declare-target-5.f90
@@ -1,3 +1,4 @@
+! { dg-additional-options "-Wno-deprecated-openmp" }
 subroutine foo()
   !$omp declare target  to(foo) device_type(bar)  ! { dg-error "Expected HOST, NOHOST or ANY" }
 end
diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-target-indirect-1.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-target-indirect-1.f90
index 504c1a29813..b50fb37027f 100644
--- a/gcc/testsuite/gfortran.dg/gomp/declare-target-indirect-1.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/declare-target-indirect-1.f90
@@ -1,6 +1,6 @@
 ! { dg-do compile }
 ! { dg-options "-fopenmp" }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
 module m
   integer :: a
   integer, parameter :: X = 1
diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-target-indirect-2.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-target-indirect-2.f90
index f6b3ae17856..d985b52e1bd 100644
--- a/gcc/testsuite/gfortran.dg/gomp/declare-target-indirect-2.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/declare-target-indirect-2.f90
@@ -1,6 +1,6 @@
 ! { dg-do compile }
 ! { dg-options "-fopenmp -fdump-tree-gimple" }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
 module m
 contains
   subroutine sub1
diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-variant-10.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-variant-10.f90
index 01f59c52808..0e0ab518010 100644
--- a/gcc/testsuite/gfortran.dg/gomp/declare-variant-10.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/declare-variant-10.f90
@@ -1,7 +1,7 @@
 ! { dg-do compile }
 ! { dg-additional-options "-cpp -foffload=disable -fdump-tree-gimple" }
 ! { dg-additional-options "-mavx512bw" { target { i?86-*-* x86_64-*-* } } }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
 #undef i386
 
 program main
diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-variant-8.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-variant-8.f90
index e3935768bc4..68ff1e1333e 100644
--- a/gcc/testsuite/gfortran.dg/gomp/declare-variant-8.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/declare-variant-8.f90
@@ -1,6 +1,6 @@
 ! { dg-do compile }
 ! { dg-additional-options "-fdump-tree-gimple" }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
 program main
   !$omp requires atomic_default_mem_order(seq_cst)
   !$omp declare target to (test3)
diff --git a/gcc/testsuite/gfortran.dg/gomp/implicit-save.f90 b/gcc/testsuite/gfortran.dg/gomp/implicit-save.f90
index 2af9647490e..041de9799c3 100644
--- a/gcc/testsuite/gfortran.dg/gomp/implicit-save.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/implicit-save.f90
@@ -1,11 +1,11 @@
 subroutine foo
   integer :: n = 5, m = 7
-  !$omp declare target to(n)
+  !$omp declare target to(n) ! { dg-warning "'to' clause with 'declare target' at \\(1\\) deprecated since OpenMP 5.2, use 'enter' \\\[-Wdeprecated-openmp\\\]" }
   !$omp threadprivate (m)
 end
 
 program main
   integer :: i, j
-  !$omp declare target to(i)
+  !$omp declare target to(i) ! { dg-warning "'to' clause with 'declare target' at \\(1\\) deprecated since OpenMP 5.2, use 'enter' \\\[-Wdeprecated-openmp\\\]" }
   !$omp threadprivate (j)
 end
diff --git a/gcc/testsuite/gfortran.dg/gomp/linear-1.f90 b/gcc/testsuite/gfortran.dg/gomp/linear-1.f90
index 0d7eb8e3f8f..cc306ba49a7 100644
--- a/gcc/testsuite/gfortran.dg/gomp/linear-1.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/linear-1.f90
@@ -1,3 +1,4 @@
+! { dg-additional-options "-Wno-deprecated-openmp" }
 subroutine foo (x, y)
   integer :: i, x, y
   common /i/ i
diff --git a/gcc/testsuite/gfortran.dg/gomp/linear-2.f90 b/gcc/testsuite/gfortran.dg/gomp/linear-2.f90
index 88df96e9b8f..31288a6e430 100644
--- a/gcc/testsuite/gfortran.dg/gomp/linear-2.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/linear-2.f90
@@ -1,6 +1,6 @@
 ! { dg-do compile }
 ! { dg-options "-fopenmp -fdump-tree-original" }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
 module m
   implicit none (type, external)
 
diff --git a/gcc/testsuite/gfortran.dg/gomp/linear-3.f90 b/gcc/testsuite/gfortran.dg/gomp/linear-3.f90
index dee87b1a899..ddbe4bc21ec 100644
--- a/gcc/testsuite/gfortran.dg/gomp/linear-3.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/linear-3.f90
@@ -1,6 +1,6 @@
 ! { dg-do compile }
 ! { dg-options "-fopenmp" }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
 module m2
   implicit none (type, external)
 
diff --git a/gcc/testsuite/gfortran.dg/gomp/linear-4.f90 b/gcc/testsuite/gfortran.dg/gomp/linear-4.f90
index ac532f81000..e72211e458d 100644
--- a/gcc/testsuite/gfortran.dg/gomp/linear-4.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/linear-4.f90
@@ -1,6 +1,6 @@
 ! { dg-do compile }
 ! { dg-options "-fopenmp" }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
 module m
 implicit none
 
diff --git a/gcc/testsuite/gfortran.dg/gomp/linear-6.f90 b/gcc/testsuite/gfortran.dg/gomp/linear-6.f90
index 57693ba6de1..42123e251ed 100644
--- a/gcc/testsuite/gfortran.dg/gomp/linear-6.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/linear-6.f90
@@ -1,6 +1,6 @@
 ! { dg-do compile }
 ! { dg-options "-fopenmp" }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
 module m
 implicit none
 integer, parameter :: val = 1
diff --git a/gcc/testsuite/gfortran.dg/gomp/map-12.f90 b/gcc/testsuite/gfortran.dg/gomp/map-12.f90
index ac9a0f8aae0..e45ac73de34 100644
--- a/gcc/testsuite/gfortran.dg/gomp/map-12.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/map-12.f90
@@ -1,5 +1,5 @@
 ! { dg-additional-options "-fdump-tree-omplower -fdump-tree-original" }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
 subroutine foo
   implicit none
   integer :: a, b, b1
diff --git a/gcc/testsuite/gfortran.dg/gomp/map-6.f90 b/gcc/testsuite/gfortran.dg/gomp/map-6.f90
index 309f8454333..33df6900630 100644
--- a/gcc/testsuite/gfortran.dg/gomp/map-6.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/map-6.f90
@@ -1,5 +1,5 @@
 ! { dg-additional-options "-fdump-tree-original" }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
 implicit none
 
 integer :: a, b, b1, b2, b3, b4, b5, b6
diff --git a/gcc/testsuite/gfortran.dg/gomp/map-7.f90 b/gcc/testsuite/gfortran.dg/gomp/map-7.f90
index 317090acb50..13c06ec01cf 100644
--- a/gcc/testsuite/gfortran.dg/gomp/map-7.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/map-7.f90
@@ -1,5 +1,5 @@
 ! { dg-additional-options "-fdump-tree-original" }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
 implicit none
 
 integer :: a, b, close, always, to, present
diff --git a/gcc/testsuite/gfortran.dg/gomp/map-8.f90 b/gcc/testsuite/gfortran.dg/gomp/map-8.f90
index 15ebdd68b95..c131291efad 100644
--- a/gcc/testsuite/gfortran.dg/gomp/map-8.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/map-8.f90
@@ -1,3 +1,4 @@
+! { dg-additional-options "-Wno-deprecated-openmp" }
 implicit none
 
 integer :: a
diff --git a/gcc/testsuite/gfortran.dg/gomp/order-8.f90 b/gcc/testsuite/gfortran.dg/gomp/order-8.f90
index 80b4b722be0..37b138b09cb 100644
--- a/gcc/testsuite/gfortran.dg/gomp/order-8.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/order-8.f90
@@ -1,3 +1,4 @@
+! { dg-additional-options "-Wno-deprecated-openmp" }
 subroutine f1 (a)
   integer :: a(*)
   integer i
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr83977.f90 b/gcc/testsuite/gfortran.dg/gomp/pr83977.f90
index b8ad1a7e39c..dea5406dea8 100644
--- a/gcc/testsuite/gfortran.dg/gomp/pr83977.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/pr83977.f90
@@ -1,6 +1,6 @@
 ! PR middle-end/83977
 ! { dg-do compile }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
 integer function foo (a, b)
    integer :: a, b
 !$omp declare simd uniform(b) linear(ref(a):b)
diff --git a/gcc/testsuite/gfortran.dg/gomp/reduction1.f90 b/gcc/testsuite/gfortran.dg/gomp/reduction1.f90
index cdc530bf0f2..a9789361e91 100644
--- a/gcc/testsuite/gfortran.dg/gomp/reduction1.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/reduction1.f90
@@ -1,7 +1,7 @@
 ! { dg-do compile }
 ! { dg-options "-fopenmp -fmax-errors=100" }
 ! { dg-require-effective-target tls }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
 subroutine foo (ia1)
 integer :: i1, i2, i3
 integer, dimension (*) :: ia1
diff --git a/gcc/testsuite/gfortran.dg/gomp/schedule-modifiers-2.f90 b/gcc/testsuite/gfortran.dg/gomp/schedule-modifiers-2.f90
index 537fba23c11..864a36ce337 100644
--- a/gcc/testsuite/gfortran.dg/gomp/schedule-modifiers-2.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/schedule-modifiers-2.f90
@@ -1,6 +1,6 @@
 ! { dg-do compile }
 ! { dg-options "-fopenmp" }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
 subroutine foo
   integer :: i
   !$omp do schedule (nonmonotonic: static, 2)
diff --git a/gcc/testsuite/gfortran.dg/gomp/workshare-reduction-55.f90 b/gcc/testsuite/gfortran.dg/gomp/workshare-reduction-55.f90
index 4d2e1e509ef..aa8effe3ec2 100644
--- a/gcc/testsuite/gfortran.dg/gomp/workshare-reduction-55.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/workshare-reduction-55.f90
@@ -1,5 +1,6 @@
 ! { dg-do compile }
 ! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-additional-options "-Wno-deprecated-openmp" }
 ! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_doacross_start \[^\n\r]*, (?:2147483648|-2147483648), 0, " 1 "optimized" } }
 ! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
 ! { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_post " 1 "optimized" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/workshare-reduction-56.f90 b/gcc/testsuite/gfortran.dg/gomp/workshare-reduction-56.f90
index a5fa4c04c6f..21161926757 100644
--- a/gcc/testsuite/gfortran.dg/gomp/workshare-reduction-56.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/workshare-reduction-56.f90
@@ -1,5 +1,6 @@
 ! { dg-do compile }
 ! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-additional-options "-Wno-deprecated-openmp" }
 ! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop(?:_ull)?_doacross_start \[^\n\r]*, (?:2147483649|-2147483647), 0, " 1 "optimized" } }
 ! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
 ! { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross(?:_ull)?_post " 1 "optimized" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/workshare-reduction-57.f90 b/gcc/testsuite/gfortran.dg/gomp/workshare-reduction-57.f90
index 6c52abacfaa..f95ad77db0b 100644
--- a/gcc/testsuite/gfortran.dg/gomp/workshare-reduction-57.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/workshare-reduction-57.f90
@@ -1,5 +1,6 @@
 ! { dg-do compile }
 ! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-additional-options "-Wno-deprecated-openmp" }
 ! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop(?:_ull)?_doacross_start \[^\n\r]*, (?:2147483650|-2147483646), 1, " 1 "optimized" } }
 ! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
 ! { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross(?:_ull)?_post " 1 "optimized" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/workshare-reduction-58.f90 b/gcc/testsuite/gfortran.dg/gomp/workshare-reduction-58.f90
index ae4f8bc5ef8..eae6277b5de 100644
--- a/gcc/testsuite/gfortran.dg/gomp/workshare-reduction-58.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/workshare-reduction-58.f90
@@ -1,5 +1,6 @@
 ! { dg-do compile }
 ! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-additional-options "-Wno-deprecated-openmp" }
 ! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_doacross_start \[^\n\r]*, (?:2147483651|-2147483645), 1, " 1 "optimized" } }
 ! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
 ! { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_post " 1 "optimized" } }
diff --git a/libgomp/testsuite/libgomp.fortran/allocate-8a.f90 b/libgomp/testsuite/libgomp.fortran/allocate-8a.f90
index 5f6c8c1e271..00416ed1a19 100644
--- a/libgomp/testsuite/libgomp.fortran/allocate-8a.f90
+++ b/libgomp/testsuite/libgomp.fortran/allocate-8a.f90
@@ -1,5 +1,6 @@
 ! { dg-additional-options "-fopenmp-allocators" }
 ! { dg-additional-options "-fdump-tree-omplower" }
+! { dg-additional-options "-Wno-deprecated-openmp" }
 program main
   use iso_c_binding
   use omp_lib
diff --git a/libgomp/testsuite/libgomp.fortran/allocators-1.f90 b/libgomp/testsuite/libgomp.fortran/allocators-1.f90
index 935a37cd959..8e1d1944fa5 100644
--- a/libgomp/testsuite/libgomp.fortran/allocators-1.f90
+++ b/libgomp/testsuite/libgomp.fortran/allocators-1.f90
@@ -1,9 +1,10 @@
 ! { dg-additional-options "-fopenmp-allocators -fdump-tree-original" }
+! { dg-additional-options "-Wno-deprecated-openmp" }
 module m
   use omp_lib
   use iso_c_binding, only: c_intptr_t
   implicit none (type,external)
-  integer(omp_allocator_handle_kind) :: handle  
+  integer(omp_allocator_handle_kind) :: handle
   integer(c_intptr_t) :: iptr
 end module m
 
diff --git a/libgomp/testsuite/libgomp.fortran/allocators-2.f90 b/libgomp/testsuite/libgomp.fortran/allocators-2.f90
index c42fbd31e3e..ada24de6131 100644
--- a/libgomp/testsuite/libgomp.fortran/allocators-2.f90
+++ b/libgomp/testsuite/libgomp.fortran/allocators-2.f90
@@ -1,4 +1,5 @@
 ! { dg-additional-options "-fopenmp-allocators" }
+! { dg-additional-options "-Wno-deprecated-openmp" }
 module m
   implicit none (type, external)
   type t
diff --git a/libgomp/testsuite/libgomp.fortran/allocators-4.f90 b/libgomp/testsuite/libgomp.fortran/allocators-4.f90
index 12689ea41ac..a58c2d35283 100644
--- a/libgomp/testsuite/libgomp.fortran/allocators-4.f90
+++ b/libgomp/testsuite/libgomp.fortran/allocators-4.f90
@@ -1,4 +1,5 @@
 ! { dg-additional-options "-fopenmp-allocators" }
+! { dg-additional-options "-Wno-deprecated-openmp" }
 module m
 implicit none
 type t
diff --git a/libgomp/testsuite/libgomp.fortran/declare-target-1.f90 b/libgomp/testsuite/libgomp.fortran/declare-target-1.f90
index d9abf685a54..894c5415495 100644
--- a/libgomp/testsuite/libgomp.fortran/declare-target-1.f90
+++ b/libgomp/testsuite/libgomp.fortran/declare-target-1.f90
@@ -1,6 +1,6 @@
 ! { dg-do run }
 ! { dg-additional-sources declare-target-2.f90 }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
 module declare_target_1_mod
   integer :: var_x, var_y, var_z
   !$omp declare target(var_x)
diff --git a/libgomp/testsuite/libgomp.fortran/declare-target-2.f90 b/libgomp/testsuite/libgomp.fortran/declare-target-2.f90
index 2210fc5a52f..12ec7bc92b3 100644
--- a/libgomp/testsuite/libgomp.fortran/declare-target-2.f90
+++ b/libgomp/testsuite/libgomp.fortran/declare-target-2.f90
@@ -2,7 +2,6 @@
 ! file compiled together with declare-target-1.f90
 ! to verify inter-CU module handling of omp declare target.
 ! { dg-do compile { target { lp64 && { ! lp64 } } } }
-
 subroutine foo
   use declare_target_1_mod
 
diff --git a/libgomp/testsuite/libgomp.fortran/declare-target-indirect-1.f90 b/libgomp/testsuite/libgomp.fortran/declare-target-indirect-1.f90
index 39a91dfcdca..7a870acd56c 100644
--- a/libgomp/testsuite/libgomp.fortran/declare-target-indirect-1.f90
+++ b/libgomp/testsuite/libgomp.fortran/declare-target-indirect-1.f90
@@ -1,5 +1,5 @@
 ! { dg-do run }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
 module m
 contains
   integer function foo ()
diff --git a/libgomp/testsuite/libgomp.fortran/declare-target-indirect-2.f90 b/libgomp/testsuite/libgomp.fortran/declare-target-indirect-2.f90
index d3baa81dd07..bdb08b5ed80 100644
--- a/libgomp/testsuite/libgomp.fortran/declare-target-indirect-2.f90
+++ b/libgomp/testsuite/libgomp.fortran/declare-target-indirect-2.f90
@@ -1,5 +1,5 @@
 ! { dg-do run }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
 module m
 contains
   integer function foo ()
diff --git a/libgomp/testsuite/libgomp.fortran/doacross1.f90 b/libgomp/testsuite/libgomp.fortran/doacross1.f90
index 2b15e7d7d11..da2d664816e 100644
--- a/libgomp/testsuite/libgomp.fortran/doacross1.f90
+++ b/libgomp/testsuite/libgomp.fortran/doacross1.f90
@@ -1,5 +1,5 @@
 ! { dg-do run }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
   integer, parameter :: N = 256
   integer, save :: a(N), b(N / 16, 8, 4), c(N / 32, 8, 8)
   integer, save, volatile :: d, e
diff --git a/libgomp/testsuite/libgomp.fortran/doacross2.f90 b/libgomp/testsuite/libgomp.fortran/doacross2.f90
index 213ac715f9e..47aa7d1873c 100644
--- a/libgomp/testsuite/libgomp.fortran/doacross2.f90
+++ b/libgomp/testsuite/libgomp.fortran/doacross2.f90
@@ -1,5 +1,5 @@
 ! { dg-do run }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
   integer, parameter :: N = 256
   integer, save :: a(N), b(N / 16, 8, 4), c(N / 32, 8, 8), g(N/16,8,6)
   integer, save, volatile :: d, e
diff --git a/libgomp/testsuite/libgomp.fortran/doacross3.f90 b/libgomp/testsuite/libgomp.fortran/doacross3.f90
index 5ba57008c6f..6deaf7164e0 100644
--- a/libgomp/testsuite/libgomp.fortran/doacross3.f90
+++ b/libgomp/testsuite/libgomp.fortran/doacross3.f90
@@ -1,5 +1,5 @@
 ! { dg-do run }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
   integer, parameter :: N = 256
   integer, save :: a(N), b(N / 16, 8, 4), c(N / 32, 8, 8), g(N/16,8,6)
   integer, save, volatile :: d, e
diff --git a/libgomp/testsuite/libgomp.fortran/map-alloc-ptr-2.f90 b/libgomp/testsuite/libgomp.fortran/map-alloc-ptr-2.f90
index c69a9bf44ad..1ff6a7f9024 100644
--- a/libgomp/testsuite/libgomp.fortran/map-alloc-ptr-2.f90
+++ b/libgomp/testsuite/libgomp.fortran/map-alloc-ptr-2.f90
@@ -1,5 +1,5 @@
 ! { dg-do run }
-! 
+! { dg-additional-options "-Wno-deprecated-openmp" }
 ! PR fortran/96668
 
 module m
diff --git a/libgomp/testsuite/libgomp.fortran/pr84418-1.f90 b/libgomp/testsuite/libgomp.fortran/pr84418-1.f90
index 8547fceb79e..65dae5d0b0b 100644
--- a/libgomp/testsuite/libgomp.fortran/pr84418-1.f90
+++ b/libgomp/testsuite/libgomp.fortran/pr84418-1.f90
@@ -20,7 +20,7 @@
 contains
   real function foo (x, y)
     real :: x, y
-    !$omp declare simd linear (ref (x, y))
+    !$omp declare simd linear (ref (x, y)) ! { dg-warning "Specification of the list items as arguments to the modifiers at \\(1\\) is deprecated since OpenMP 5.2 \\\[-Wdeprecated-openmp\\\]" }
     foo = x + y
   end function
 end
diff --git a/libgomp/testsuite/libgomp.fortran/pr84418-2.f90 b/libgomp/testsuite/libgomp.fortran/pr84418-2.f90
index 481e24e5d8a..0a50a539ae8 100644
--- a/libgomp/testsuite/libgomp.fortran/pr84418-2.f90
+++ b/libgomp/testsuite/libgomp.fortran/pr84418-2.f90
@@ -3,7 +3,7 @@
 ! { dg-options "-fno-inline" }
 ! { dg-additional-options "-msse2" { target sse2_runtime } }
 ! { dg-additional-options "-mavx" { target avx_runtime } }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
   type p
     integer :: i, j
   end type
@@ -25,7 +25,7 @@
   do i = 1, 1024
     if (c(i).ne.(6 * i)) stop 1
   end do
-contains  
+contains
   function foo (x, y)
     type (p) :: x
     integer :: y(4), foo
diff --git a/libgomp/testsuite/libgomp.fortran/reduction1.f90 b/libgomp/testsuite/libgomp.fortran/reduction1.f90
index 622a7059d6c..f02526b715e 100644
--- a/libgomp/testsuite/libgomp.fortran/reduction1.f90
+++ b/libgomp/testsuite/libgomp.fortran/reduction1.f90
@@ -77,7 +77,7 @@
   cnt = -1
 
 !$omp parallel num_threads (3) private (n) reduction (.or.:v) &
-!$omp & reduction (-:i, ia, r, ra, d, da, c, ca)
+!$omp & reduction (-:i, ia, r, ra, d, da, c, ca) ! { dg-warning "'-' operator at \\(1\\) for reductions deprecated in OpenMP 5.2 \\\[-Wdeprecated-openmp\\\]" }
 !$ if (i .ne. 0 .or. any (ia .ne. 0)) v = .true.
 !$ if (r .ne. 0 .or. any (ra .ne. 0)) v = .true.
 !$ if (d .ne. 0 .or. any (da .ne. 0)) v = .true.
diff --git a/libgomp/testsuite/libgomp.fortran/udr11.f90 b/libgomp/testsuite/libgomp.fortran/udr11.f90
index 57989be4a01..a60822cd7aa 100644
--- a/libgomp/testsuite/libgomp.fortran/udr11.f90
+++ b/libgomp/testsuite/libgomp.fortran/udr11.f90
@@ -1,5 +1,5 @@
 ! { dg-do run }
-
+! { dg-additional-options "-Wno-deprecated-openmp" }
 module udr11
   type dt
     integer :: x = 0
-- 
2.51.1

Reply via email to