[OpenMP,gimplifier] 'inform' after 'error' diagnostic

Message ID 87r1w59ti3.fsf@euler.schwinge.homeip.net
State New
Headers show
Series
  • [OpenMP,gimplifier] 'inform' after 'error' diagnostic
Related show

Commit Message

Thomas Schwinge April 30, 2020, 10:07 a.m.
Hi!

Is the attached OK for master branch, in next stage 1?  It may even be
obvious, per our diagnostic conventions?  If approving this patch, please
respond with "Reviewed-by: NAME <EMAIL>" so that your effort will be
recorded in the commit log, see <https://gcc.gnu.org/wiki/Reviewed-by>.


Grüße
 Thomas


-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter

Comments

Richard Biener via Gcc-patches April 30, 2020, 10:14 a.m. | #1
On Thu, Apr 30, 2020 at 12:07:32PM +0200, Thomas Schwinge wrote:
> Hi!

> 

> Is the attached OK for master branch, in next stage 1?  It may even be

> obvious, per our diagnostic conventions?  If approving this patch, please

> respond with "Reviewed-by: NAME <EMAIL>" so that your effort will be

> recorded in the commit log, see <https://gcc.gnu.org/wiki/Reviewed-by>.


Ok for stage1, thanks.

	Jakub
Thomas Schwinge June 17, 2020, 10:26 p.m. | #2
Hi!

On 2020-04-30T12:14:39+0200, Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> On Thu, Apr 30, 2020 at 12:07:32PM +0200, Thomas Schwinge wrote:

>> Is the attached OK for master branch, in next stage 1?  [...]

>

> Ok for stage1, thanks.


Thanks.  I've now pushed "[OpenMP, gimplifier] 'inform' after 'error'
diagnostic" to master branch in commit
4f2ab6b89e170f1343f935761481c3745fe603b1, see attached.


Grüße
 Thomas


-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter
From 4f2ab6b89e170f1343f935761481c3745fe603b1 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>

Date: Thu, 30 Apr 2020 09:07:06 +0200
Subject: [PATCH] [OpenMP, gimplifier] 'inform' after 'error' diagnostic

This is not a thorough review of the code, just a few cases I noticed while
scanning 'gcc/gimplify.c' for "enclosing".

	gcc/
	* gimplify.c (omp_notice_threadprivate_variable)
	(omp_default_clause, omp_notice_variable): 'inform' after 'error'
	diagnostic.  Adjust all users.
	gcc/testsuite/
	* c-c++-common/gomp/default-1.c: Update.
	* c-c++-common/gomp/defaultmap-3.c: Likewise.
	* c-c++-common/gomp/order-4.c: Likewise.
	* g++.dg/gomp/parallel-2.C: Likewise.
	* g++.dg/gomp/predetermined-1.C: Likewise.
	* g++.dg/gomp/sharing-1.C: Likewise.
	* gcc.dg/gomp/appendix-a/a.24.1.c: Likewise.
	* gcc.dg/gomp/parallel-2.c: Likewise.
	* gcc.dg/gomp/pr44085.c: Likewise.
	* gcc.dg/gomp/sharing-1.c: Likewise.
	* gcc.dg/gomp/vla-1.c: Likewise.
	* gfortran.dg/gomp/appendix-a/a.24.1.f90: Likewise.
	* gfortran.dg/gomp/crayptr3.f90: Likewise.
	* gfortran.dg/gomp/pr33439.f90: Likewise.
	* gfortran.dg/gomp/pr44036-1.f90: Likewise.
	* gfortran.dg/gomp/pr44085.f90: Likewise.
	* gfortran.dg/gomp/pr44536.f90: Likewise.
	* gfortran.dg/gomp/pr94672.f90: Likewise.
	* gfortran.dg/gomp/sharing-1.f90: Likewise.
	* gfortran.dg/gomp/sharing-2.f90: Likewise.
	* gfortran.dg/gomp/sharing-3.f90: Likewise.
---
 gcc/gimplify.c                                     | 10 +++++-----
 gcc/testsuite/c-c++-common/gomp/default-1.c        |  8 ++++----
 gcc/testsuite/c-c++-common/gomp/defaultmap-3.c     |  6 +++---
 gcc/testsuite/c-c++-common/gomp/order-4.c          |  8 ++++----
 gcc/testsuite/g++.dg/gomp/parallel-2.C             |  4 ++--
 gcc/testsuite/g++.dg/gomp/predetermined-1.C        | 14 +++++++-------
 gcc/testsuite/g++.dg/gomp/sharing-1.C              |  2 +-
 gcc/testsuite/gcc.dg/gomp/appendix-a/a.24.1.c      |  2 +-
 gcc/testsuite/gcc.dg/gomp/parallel-2.c             |  4 ++--
 gcc/testsuite/gcc.dg/gomp/pr44085.c                |  2 +-
 gcc/testsuite/gcc.dg/gomp/sharing-1.c              |  2 +-
 gcc/testsuite/gcc.dg/gomp/vla-1.c                  |  2 +-
 .../gfortran.dg/gomp/appendix-a/a.24.1.f90         |  2 +-
 gcc/testsuite/gfortran.dg/gomp/crayptr3.f90        |  2 +-
 gcc/testsuite/gfortran.dg/gomp/pr33439.f90         |  7 ++++---
 gcc/testsuite/gfortran.dg/gomp/pr44036-1.f90       |  4 ++--
 gcc/testsuite/gfortran.dg/gomp/pr44085.f90         |  2 +-
 gcc/testsuite/gfortran.dg/gomp/pr44536.f90         |  2 +-
 gcc/testsuite/gfortran.dg/gomp/pr94672.f90         | 10 +++++-----
 gcc/testsuite/gfortran.dg/gomp/sharing-1.f90       |  2 +-
 gcc/testsuite/gfortran.dg/gomp/sharing-2.f90       | 10 +++++-----
 gcc/testsuite/gfortran.dg/gomp/sharing-3.f90       |  2 +-
 22 files changed, 54 insertions(+), 53 deletions(-)

diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index ab3408f480e6..968fae2f1a3c 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -7096,13 +7096,13 @@ omp_notice_threadprivate_variable (struct gimplify_omp_ctx *ctx, tree decl,
 	      {
 		error ("threadprivate variable %qE used in a region with"
 		       " %<order(concurrent)%> clause", DECL_NAME (decl));
-		error_at (octx->location, "enclosing region");
+		inform (octx->location, "enclosing region");
 	      }
 	    else
 	      {
 		error ("threadprivate variable %qE used in target region",
 		       DECL_NAME (decl));
-		error_at (octx->location, "enclosing target region");
+		inform (octx->location, "enclosing target region");
 	      }
 	    splay_tree_insert (octx->variables, (splay_tree_key)decl, 0);
 	  }
@@ -7117,7 +7117,7 @@ omp_notice_threadprivate_variable (struct gimplify_omp_ctx *ctx, tree decl,
     {
       error ("threadprivate variable %qE used in untied task",
 	     DECL_NAME (decl));
-      error_at (ctx->location, "enclosing task");
+      inform (ctx->location, "enclosing task");
       splay_tree_insert (ctx->variables, (splay_tree_key)decl, 0);
     }
   if (decl2)
@@ -7195,7 +7195,7 @@ omp_default_clause (struct gimplify_omp_ctx *ctx, tree decl,
 	
 	error ("%qE not specified in enclosing %qs",
 	       DECL_NAME (lang_hooks.decls.omp_report_decl (decl)), rtype);
-	error_at (ctx->location, "enclosing %qs", rtype);
+	inform (ctx->location, "enclosing %qs", rtype);
       }
       /* FALLTHRU */
     case OMP_CLAUSE_DEFAULT_SHARED:
@@ -7476,7 +7476,7 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code)
 		      tree d = lang_hooks.decls.omp_report_decl (decl);
 		      error ("%qE not specified in enclosing %<target%>",
 			     DECL_NAME (d));
-		      error_at (ctx->location, "enclosing %<target%>");
+		      inform (ctx->location, "enclosing %<target%>");
 		    }
 		  else if (ctx->defaultmap[gdmk]
 			   & (GOVD_MAP_0LEN_ARRAY | GOVD_FIRSTPRIVATE))
diff --git a/gcc/testsuite/c-c++-common/gomp/default-1.c b/gcc/testsuite/c-c++-common/gomp/default-1.c
index 6525483c44e7..eab46892dada 100644
--- a/gcc/testsuite/c-c++-common/gomp/default-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/default-1.c
@@ -2,20 +2,20 @@ void
 foo (void)
 {
   int x = 0, i;
-  #pragma omp task default(none)	/* { dg-error "enclosing 'task'" } */
+  #pragma omp task default(none)	/* { dg-message "note: enclosing 'task'" } */
   {
     x++;	/* { dg-error "'x' not specified in enclosing 'task'" } */
   }
-  #pragma omp taskloop default(none)	/* { dg-error "enclosing 'taskloop'" } */
+  #pragma omp taskloop default(none)	/* { dg-message "note: enclosing 'taskloop'" } */
   for (i = 0; i < 64; i++)
     {
       x++;	/* { dg-error "'x' not specified in enclosing 'taskloop'" } */
     }
-  #pragma omp teams default(none)	/* { dg-error "enclosing 'teams'" } */
+  #pragma omp teams default(none)	/* { dg-message "note: enclosing 'teams'" } */
   {
     x++;	/* { dg-error "'x' not specified in enclosing 'teams'" } */
   }
-  #pragma omp parallel default(none)	/* { dg-error "enclosing 'parallel'" } */
+  #pragma omp parallel default(none)	/* { dg-message "note: enclosing 'parallel'" } */
   {
     x++;	/* { dg-error "'x' not specified in enclosing 'parallel'" } */
   }
diff --git a/gcc/testsuite/c-c++-common/gomp/defaultmap-3.c b/gcc/testsuite/c-c++-common/gomp/defaultmap-3.c
index 2f5b303958f4..8be23fd14735 100644
--- a/gcc/testsuite/c-c++-common/gomp/defaultmap-3.c
+++ b/gcc/testsuite/c-c++-common/gomp/defaultmap-3.c
@@ -11,7 +11,7 @@ f1 (int sc1, struct S ag1, int *pt1)
 {
   char ar1[N];
   foo (ar1);
-  #pragma omp target defaultmap(default:scalar) defaultmap(to:aggregate) defaultmap(none:pointer)	/* { dg-error "enclosing 'target'" } */
+  #pragma omp target defaultmap(default:scalar) defaultmap(to:aggregate) defaultmap(none:pointer)	/* { dg-message "note: enclosing 'target'" } */
   bar (sc1, ar1, ag1, pt1);	/* { dg-error "'pt1' not specified in enclosing 'target'" } */
 }
 
@@ -20,7 +20,7 @@ f2 (int sc2, struct S ag2, int *pt2)
 {
   char ar2[N];
   foo (ar2);
-  #pragma omp target defaultmap(none:scalar) defaultmap(from:aggregate) defaultmap(default:pointer)	/* { dg-error "enclosing 'target'" } */
+  #pragma omp target defaultmap(none:scalar) defaultmap(from:aggregate) defaultmap(default:pointer)	/* { dg-message "note: enclosing 'target'" } */
   bar (sc2, ar2, ag2, pt2);	/* { dg-error "'sc2' not specified in enclosing 'target'" } */
 }
 
@@ -29,6 +29,6 @@ f3 (int sc3, struct S ag3, int *pt3)
 {
   char ar3[N];
   foo (ar3);
-  #pragma omp target defaultmap(firstprivate:scalar) defaultmap(none:aggregate) defaultmap(to:pointer)	/* { dg-error "enclosing 'target'" } */
+  #pragma omp target defaultmap(firstprivate:scalar) defaultmap(none:aggregate) defaultmap(to:pointer)	/* { dg-message "note: enclosing 'target'" } */
   bar (sc3, ar3, ag3, pt3);	/* { dg-error "'ar3' not specified in enclosing 'target'" } */
 }				/* { dg-error "'ag3' not specified in enclosing 'target'" "" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/c-c++-common/gomp/order-4.c b/gcc/testsuite/c-c++-common/gomp/order-4.c
index f916772ceea7..d1109bb13b3b 100644
--- a/gcc/testsuite/c-c++-common/gomp/order-4.c
+++ b/gcc/testsuite/c-c++-common/gomp/order-4.c
@@ -5,7 +5,7 @@ void
 f1 (void)
 {
   int i;
-  #pragma omp simd order(concurrent)	/* { dg-error "enclosing region" } */
+  #pragma omp simd order(concurrent)	/* { dg-message "note: enclosing region" } */
   for (i = 0; i < 64; i++)
     t++;	/* { dg-error "threadprivate variable 't' used in a region with 'order\\(concurrent\\)' clause" } */
 }
@@ -14,8 +14,8 @@ void
 f2 (void)
 {
   int i;
-  #pragma omp for simd order(concurrent)	/* { dg-error "enclosing region" } */
-  for (i = 0; i < 64; i++)			/* { dg-error "enclosing region" "" { target c++ } } */
+  #pragma omp for simd order(concurrent)	/* { dg-message "note: enclosing region" } */
+  for (i = 0; i < 64; i++)			/* { dg-message "note: enclosing region" "" { target c++ } } */
     t++;	/* { dg-error "threadprivate variable 't' used in a region with 'order\\(concurrent\\)' clause" } */
 }
 
@@ -23,7 +23,7 @@ void
 f3 (void)
 {
   int i;
-  #pragma omp for order(concurrent)	/* { dg-error "enclosing region" } */
+  #pragma omp for order(concurrent)	/* { dg-message "note: enclosing region" } */
   for (i = 0; i < 64; i++)
     t++;	/* { dg-error "threadprivate variable 't' used in a region with 'order\\(concurrent\\)' clause" } */
 }
diff --git a/gcc/testsuite/g++.dg/gomp/parallel-2.C b/gcc/testsuite/g++.dg/gomp/parallel-2.C
index 68e577766b1f..38875ad94ed6 100644
--- a/gcc/testsuite/g++.dg/gomp/parallel-2.C
+++ b/gcc/testsuite/g++.dg/gomp/parallel-2.C
@@ -4,11 +4,11 @@ void foo()
 {
   int i;
 
-  #pragma omp parallel default(none)		// { dg-error "enclosing" }
+  #pragma omp parallel default(none)		// { dg-message "note: enclosing 'parallel'" }
     {
     #pragma omp parallel
       {
-      #pragma omp parallel default(none)	// { dg-error "enclosing" }
+      #pragma omp parallel default(none)	// { dg-message "note: enclosing 'parallel'" }
         {
  	  i++;					// { dg-error "not specified" }
 	}
diff --git a/gcc/testsuite/g++.dg/gomp/predetermined-1.C b/gcc/testsuite/g++.dg/gomp/predetermined-1.C
index 084f04ec90f2..74cd74febdfb 100644
--- a/gcc/testsuite/g++.dg/gomp/predetermined-1.C
+++ b/gcc/testsuite/g++.dg/gomp/predetermined-1.C
@@ -15,19 +15,19 @@ const A foo (const A d, const C e)
   const A f;
   const B b = { 4 };
   A g;
-  #pragma omp parallel default (none)	// { dg-error "enclosing 'parallel'" }
+  #pragma omp parallel default (none)	// { dg-message "note: enclosing 'parallel'" }
     bar (&a);				// { dg-error "not specified" }
-  #pragma omp parallel default (none)	// { dg-error "enclosing 'parallel'" }
+  #pragma omp parallel default (none)	// { dg-message "note: enclosing 'parallel'" }
     bar (&b);				// { dg-error "not specified" }
-  #pragma omp parallel default (none)	// { dg-error "enclosing 'parallel'" }
+  #pragma omp parallel default (none)	// { dg-message "note: enclosing 'parallel'" }
     bar (&c);				// { dg-error "not specified" }
-  #pragma omp parallel default (none)	// { dg-error "enclosing 'parallel'" }
+  #pragma omp parallel default (none)	// { dg-message "note: enclosing 'parallel'" }
     bar (&d);				// { dg-error "not specified" }
-  #pragma omp parallel default (none)	// { dg-error "enclosing 'parallel'" }
+  #pragma omp parallel default (none)	// { dg-message "note: enclosing 'parallel'" }
     bar (&e);				// { dg-error "not specified" }
-  #pragma omp parallel default (none)	// { dg-error "enclosing 'parallel'" }
+  #pragma omp parallel default (none)	// { dg-message "note: enclosing 'parallel'" }
     bar (&f);				// { dg-error "not specified" }
-  #pragma omp parallel default (none)	// { dg-error "enclosing 'parallel'" }
+  #pragma omp parallel default (none)	// { dg-message "note: enclosing 'parallel'" }
     bar (&g);				// { dg-error "not specified" }
   return f;
 }
diff --git a/gcc/testsuite/g++.dg/gomp/sharing-1.C b/gcc/testsuite/g++.dg/gomp/sharing-1.C
index ac6908b68ac5..4506170c2471 100644
--- a/gcc/testsuite/g++.dg/gomp/sharing-1.C
+++ b/gcc/testsuite/g++.dg/gomp/sharing-1.C
@@ -52,7 +52,7 @@ main (void)
   *p = 7;
   s = 6;
   l = 0;
-#pragma omp parallel for /* { dg-error "enclosing 'parallel'" } */ \
+#pragma omp parallel for /* { dg-message "note: enclosing 'parallel'" } */ \
   default (none) private (p) shared (s) 
   for (i = 0; i < 64; i++)
     {
diff --git a/gcc/testsuite/gcc.dg/gomp/appendix-a/a.24.1.c b/gcc/testsuite/gcc.dg/gomp/appendix-a/a.24.1.c
index 099f03fe89d3..47b2511508e4 100644
--- a/gcc/testsuite/gcc.dg/gomp/appendix-a/a.24.1.c
+++ b/gcc/testsuite/gcc.dg/gomp/appendix-a/a.24.1.c
@@ -21,7 +21,7 @@ a24 (int a)
 					      is listed in shared clause */
     z[i] = y;
     /* { dg-error "'i' not specified" "" { target *-*-* } .-1 } */
-    /* { dg-error "enclosing 'parallel'" "" { target *-*-* } omp_parallel } */
+    /* { dg-message "note: enclosing 'parallel'" "" { target *-*-* } omp_parallel } */
     /* { dg-error "'y' not specified" "" { target *-*-* } .-3 }  */
 #pragma omp for firstprivate(y)
     for (i = 0; i < 10; i++)
diff --git a/gcc/testsuite/gcc.dg/gomp/parallel-2.c b/gcc/testsuite/gcc.dg/gomp/parallel-2.c
index 68e577766b1f..b2d653db9e2a 100644
--- a/gcc/testsuite/gcc.dg/gomp/parallel-2.c
+++ b/gcc/testsuite/gcc.dg/gomp/parallel-2.c
@@ -4,11 +4,11 @@ void foo()
 {
   int i;
 
-  #pragma omp parallel default(none)		// { dg-error "enclosing" }
+  #pragma omp parallel default(none)		// { dg-message "note: enclosing 'parallel'" }
     {
     #pragma omp parallel
       {
-      #pragma omp parallel default(none)	// { dg-error "enclosing" }
+      #pragma omp parallel default(none)	// { dg-message: "note: enclosing 'parallel'" }
         {
  	  i++;					// { dg-error "not specified" }
 	}
diff --git a/gcc/testsuite/gcc.dg/gomp/pr44085.c b/gcc/testsuite/gcc.dg/gomp/pr44085.c
index 55462abe504e..3f3441bde88c 100644
--- a/gcc/testsuite/gcc.dg/gomp/pr44085.c
+++ b/gcc/testsuite/gcc.dg/gomp/pr44085.c
@@ -9,7 +9,7 @@ int thr1, thr2;
 void
 foo (void)
 {
-#pragma omp task untied	/* { dg-error "enclosing task" } */
+#pragma omp task untied	/* { dg-message "note: enclosing task" } */
   {
     thr1++;		/* { dg-error "used in untied task" } */
     thr2 |= 4;		/* { dg-error "used in untied task" } */
diff --git a/gcc/testsuite/gcc.dg/gomp/sharing-1.c b/gcc/testsuite/gcc.dg/gomp/sharing-1.c
index 79abb64cdd7f..2c6b01779d18 100644
--- a/gcc/testsuite/gcc.dg/gomp/sharing-1.c
+++ b/gcc/testsuite/gcc.dg/gomp/sharing-1.c
@@ -35,7 +35,7 @@ main (void)
   *p = 7;
   s = 6;
   l = 0;
-#pragma omp parallel for /* { dg-error "enclosing 'parallel'" } */ \
+#pragma omp parallel for /* { dg-message "note: enclosing 'parallel'" } */ \
   default (none) private (p) shared (s) 
   for (i = 0; i < 64; i++)
     {
diff --git a/gcc/testsuite/gcc.dg/gomp/vla-1.c b/gcc/testsuite/gcc.dg/gomp/vla-1.c
index bb37f33e60f7..dd42b9a07521 100644
--- a/gcc/testsuite/gcc.dg/gomp/vla-1.c
+++ b/gcc/testsuite/gcc.dg/gomp/vla-1.c
@@ -4,7 +4,7 @@ void foo(int n)
 {
   int A[n];
 
-  #pragma omp parallel default(none)	// { dg-error "enclosing" }
+  #pragma omp parallel default(none)	// { dg-message "note: enclosing 'parallel'" }
     {
       A[0] = 0;				// { dg-error "'A' not specified" }
     }
diff --git a/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.24.1.f90 b/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.24.1.f90
index 52a2cbb82da9..3837aab6cca7 100644
--- a/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.24.1.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.24.1.f90
@@ -19,7 +19,7 @@
       X=1      ! O.K. - X is THREADPRIVATE
       Z(I) = Y ! Error - cannot reference I or Y here
 ! { dg-error "'i' not specified" "" { target *-*-* } .-1 } */
-! { dg-error "enclosing 'parallel'" "" { target *-*-* } omp_parallel } */
+! { dg-message "note: enclosing 'parallel'" "" { target *-*-* } omp_parallel } */
 ! { dg-error "'y' not specified" "" { target *-*-* } .-3 }  */
 !$OMP DO firstprivate(y)
       DO I = 1,10
diff --git a/gcc/testsuite/gfortran.dg/gomp/crayptr3.f90 b/gcc/testsuite/gfortran.dg/gomp/crayptr3.f90
index 15bf864997f4..9a28bbc3cf23 100644
--- a/gcc/testsuite/gfortran.dg/gomp/crayptr3.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/crayptr3.f90
@@ -16,7 +16,7 @@
   a = 1
 !$omp end parallel
 
-!$omp parallel default (none)	! { dg-error "enclosing 'parallel'" }
+!$omp parallel default (none)	! { dg-message "note: enclosing 'parallel'" }
   a = 1		! { dg-error "'ip' not specified in enclosing 'parallel'" }
 !$omp end parallel
 end
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr33439.f90 b/gcc/testsuite/gfortran.dg/gomp/pr33439.f90
index 42fa22184b34..12a73d22d1af 100644
--- a/gcc/testsuite/gfortran.dg/gomp/pr33439.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/pr33439.f90
@@ -5,7 +5,7 @@
 subroutine pr33439_1
   integer :: s, i
   s = 4
-!$omp parallel default(none)	! { dg-error "enclosing 'parallel'" }
+!$omp parallel default(none)	! { dg-message "note: enclosing 'parallel'" }
   call somethingelse
 !$omp do schedule(static, s)	! { dg-error "not specified in enclosing 'parallel'" }
   do i = 1, 8
@@ -18,7 +18,7 @@ end subroutine pr33439_1
 subroutine pr33439_2
   integer :: s, i
   s = 4
-!$omp parallel default(none)	! { dg-error "enclosing 'parallel'" }
+!$omp parallel default(none)	! { dg-message "note: enclosing 'parallel'" }
 !$omp do schedule(static, s)	! { dg-error "not specified in enclosing 'parallel'" }
   do i = 1, 8
     call something
@@ -30,7 +30,8 @@ end subroutine pr33439_2
 subroutine pr33439_3
   integer :: s, i
   s = 4
-!$omp parallel do default(none) schedule(static, s) ! { dg-error "enclosing 'parallel'" }
+!$omp parallel do default(none) schedule(static, s)	! { dg-message "note: enclosing 'parallel'" }
+!							! { dg-error "'s' not specified in enclosing 'parallel'" "" { target *-*-* } .-1 }
   do i = 1, 8
     call something
   end do
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr44036-1.f90 b/gcc/testsuite/gfortran.dg/gomp/pr44036-1.f90
index 1caa93df8c3d..ef90d1326536 100644
--- a/gcc/testsuite/gfortran.dg/gomp/pr44036-1.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/pr44036-1.f90
@@ -11,14 +11,14 @@ subroutine foo(a, b)
 !$omp parallel default(none) private (x)
   x = a(4)
 !$omp end parallel
-!$omp parallel default(none) private (x)	! { dg-error "enclosing 'parallel'" }
+!$omp parallel default(none) private (x)	! { dg-message "note: enclosing 'parallel'" }
   x = b(5)					! { dg-error "not specified in" }
 !$omp end parallel
 !$omp parallel default(none) private (x)
   x = c(6)
 !$omp end parallel
   d => a
-!$omp parallel default(none) private (x)	! { dg-error "enclosing 'parallel'" }
+!$omp parallel default(none) private (x)	! { dg-message "note: enclosing 'parallel'" }
   x = d(7)					! { dg-error "not specified in" }
 !$omp end parallel
 end
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr44085.f90 b/gcc/testsuite/gfortran.dg/gomp/pr44085.f90
index db8fbbc9544f..90094d6ef47e 100644
--- a/gcc/testsuite/gfortran.dg/gomp/pr44085.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/pr44085.f90
@@ -8,7 +8,7 @@
   common /thrs/ thr3, thr4
 !$omp threadprivate (thr1, thr2, /thrs/)
 
-!$omp task untied		! { dg-error "enclosing task" }
+!$omp task untied		! { dg-message "note: enclosing task" }
   thr1 = thr1 + 1		! { dg-error "used in untied task" }
   thr2 = thr2 + 2		! { dg-error "used in untied task" }
   thr3 = thr3 + 3		! { dg-error "used in untied task" }
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr44536.f90 b/gcc/testsuite/gfortran.dg/gomp/pr44536.f90
index 4fcf5d1102b6..c1d83cdeae51 100644
--- a/gcc/testsuite/gfortran.dg/gomp/pr44536.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/pr44536.f90
@@ -4,7 +4,7 @@
       subroutine foo (a, i, j)
         integer, dimension(:) :: a
         integer :: i, j
-!$omp parallel default(none) shared(i, j)	! { dg-error "enclosing 'parallel'" }
+!$omp parallel default(none) shared(i, j)	! { dg-message "note: enclosing 'parallel'" }
         j=a(i)					! { dg-error "not specified in" }
 !$omp end parallel
       end subroutine
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr94672.f90 b/gcc/testsuite/gfortran.dg/gomp/pr94672.f90
index 7b89c5df2499..d1b066ca1efd 100644
--- a/gcc/testsuite/gfortran.dg/gomp/pr94672.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/pr94672.f90
@@ -93,35 +93,35 @@ end subroutine
 
 subroutine w1 (array)
   real, optional :: array(:)
-  !$omp parallel default(none)     ! { dg-error "enclosing 'parallel'" }
+  !$omp parallel default(none)     ! { dg-message "note: enclosing 'parallel'" }
   if (.not.present (array)) stop 1 ! { dg-error "'array' not specified in enclosing 'parallel'" }
   !$omp end parallel
 end subroutine
 
 subroutine w2 (array2)
   real, optional :: array2(*)
-  !$omp parallel default(none)      ! { dg-error "enclosing 'parallel'" "TODO" { xfail *-*-* } }
+  !$omp parallel default(none)      ! { dg-message "note: enclosing 'parallel'" "TODO" { xfail *-*-* } }
   if (.not.present (array2)) stop 2 ! { dg-error "'array2' not specified in enclosing 'parallel'" "TODO" { xfail *-*-* } }
   !$omp end parallel
 end subroutine
 
 subroutine w3 (arg)
   real, optional :: arg
-  !$omp parallel default(none)    ! { dg-error "enclosing 'parallel'" }
+  !$omp parallel default(none)    ! { dg-message "note: enclosing 'parallel'" }
   if (.not.present (arg)) stop 3  ! { dg-error "'arg' not specified in enclosing 'parallel'" }
   !$omp end parallel
 end subroutine
 
 subroutine w4 (arg2)
   real, value, optional :: arg2
-  !$omp parallel default(none)     ! { dg-error "enclosing 'parallel" "TODO" { xfail *-*-* } }
+  !$omp parallel default(none)     ! { dg-message "note: enclosing 'parallel" "TODO" { xfail *-*-* } }
   if (.not.present (arg2)) stop 4  ! { dg-error "'arg2' not specified in enclosing 'parallel'" "TODO" { xfail *-*-*} }
   !$omp end parallel
 end subroutine
 
 subroutine w5 (array3)
   real, optional :: array3(..)
-  !$omp parallel default(none)      ! { dg-error "enclosing 'parallel'" }
+  !$omp parallel default(none)      ! { dg-message "note: enclosing 'parallel'" }
   if (.not.present (array3)) stop 5 ! { dg-error "'array3' not specified in enclosing 'parallel'" }
   !$omp end parallel
 end subroutine
diff --git a/gcc/testsuite/gfortran.dg/gomp/sharing-1.f90 b/gcc/testsuite/gfortran.dg/gomp/sharing-1.f90
index ad9149ebe39d..f4958b81d6ce 100644
--- a/gcc/testsuite/gfortran.dg/gomp/sharing-1.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/sharing-1.f90
@@ -9,7 +9,7 @@
 !$omp threadprivate (/thrblk/, thrpriv)
   s = 1
 !$omp parallel do default (none) &
-!$omp & private (p) shared (s) ! { dg-error "enclosing 'parallel'" }
+!$omp & private (p) shared (s) ! { dg-message "note: enclosing 'parallel'" }
   do i = 1, 64
     call foo (thrpriv)	! Predetermined - threadprivate
     call foo (thr)	! Predetermined - threadprivate
diff --git a/gcc/testsuite/gfortran.dg/gomp/sharing-2.f90 b/gcc/testsuite/gfortran.dg/gomp/sharing-2.f90
index bf5519070d44..acc8d37771c7 100644
--- a/gcc/testsuite/gfortran.dg/gomp/sharing-2.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/sharing-2.f90
@@ -9,7 +9,7 @@
     j = 8
   end do
 !$omp end parallel do
-!$omp parallel default (none) shared (a) ! { dg-error "enclosing 'parallel'" }
+!$omp parallel default (none) shared (a) ! { dg-message "note: enclosing 'parallel'" }
   i = 1
   j = 1
   k = 1
@@ -28,7 +28,7 @@
   end do
 !$omp end single
 !$omp end parallel
-!$omp parallel default (none) shared (a) ! { dg-error "enclosing 'parallel'" }
+!$omp parallel default (none) shared (a) ! { dg-message "note: enclosing 'parallel'" }
   i = 1		! { dg-error "not specified in" }
   j = 1		! { dg-error "not specified in" }
   k = 1		! { dg-error "not specified in" }
@@ -54,21 +54,21 @@
   j = 1
   k = 1
 !$omp end parallel
-!$omp parallel default (none) shared (a) ! { dg-error "enclosing 'parallel'" }
+!$omp parallel default (none) shared (a) ! { dg-message "note: enclosing 'parallel'" }
   i = 1		! { dg-error "not specified in" }
 !$omp do
   do i = 1, 10
     a(i, 1) = i + 1
   end do
 !$omp end parallel
-!$omp parallel default (none) shared (a) ! { dg-error "enclosing 'parallel'" }
+!$omp parallel default (none) shared (a) ! { dg-message "note: enclosing 'parallel'" }
   i = 1		! { dg-error "not specified in" }
 !$omp parallel do default (none) shared (a)
   do i = 1, 10
     a(i, 1) = i + 1
   end do
 !$omp end parallel
-!$omp parallel default (none) shared (a) ! { dg-error "enclosing 'parallel'" }
+!$omp parallel default (none) shared (a) ! { dg-message "note: enclosing 'parallel'" }
   i = 1		! { dg-error "not specified in" }
 !$omp parallel default (none) shared (a, i)
   i = 2
diff --git a/gcc/testsuite/gfortran.dg/gomp/sharing-3.f90 b/gcc/testsuite/gfortran.dg/gomp/sharing-3.f90
index 221ec0023712..a9abc7b5a333 100644
--- a/gcc/testsuite/gfortran.dg/gomp/sharing-3.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/sharing-3.f90
@@ -25,7 +25,7 @@ subroutine foo (vara, varb, varc, vard, n)
     vard(1) = 1
     vare(1) = 1
   !$omp end parallel
-  !$omp parallel default(none)	! { dg-error "enclosing 'parallel'" }
+  !$omp parallel default(none)	! { dg-message "note: enclosing 'parallel'" }
     !$omp master
       vara(1) = 1		! { dg-error "not specified" }
       varb(1) = 1		! Assumed-size is predetermined
-- 
2.27.0
Richard Biener via Gcc-patches June 17, 2020, 10:32 p.m. | #3
On Thu, Jun 18, 2020 at 12:26:06AM +0200, Thomas Schwinge wrote:
> Hi!

> 

> On 2020-04-30T12:14:39+0200, Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:

> > On Thu, Apr 30, 2020 at 12:07:32PM +0200, Thomas Schwinge wrote:

> >> Is the attached OK for master branch, in next stage 1?  [...]

> >

> > Ok for stage1, thanks.

> 

> Thanks.  I've now pushed "[OpenMP, gimplifier] 'inform' after 'error'

> diagnostic" to master branch in commit

> 4f2ab6b89e170f1343f935761481c3745fe603b1, see attached.


Forgot about something, when there is more than one diagnostics tied
together, such as in these cases, one should use
  {
    auto_diagnostic_group d;
    error (...);
    inform (...);
  }
to tie them together.  Could you please change that?  Or I can do that
during the day.

	Jakub

Patch

From 28565fb32202a3b4d166ef86363d0737d077855a Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Thu, 30 Apr 2020 09:07:06 +0200
Subject: [PATCH] [OpenMP, gimplifier] 'inform' after 'error' diagnostic

This is not a thorough review of the code, just a few cases I noticed while
scanning 'gcc/gimplify.c' for "enclosing".

	gcc/
	* gimplify.c (omp_notice_threadprivate_variable)
	(omp_default_clause, omp_notice_variable): 'inform' after 'error'
	diagnostic.  Adjust all users.
---
 gcc/gimplify.c                                     | 10 +++++-----
 gcc/testsuite/c-c++-common/gomp/default-1.c        |  8 ++++----
 gcc/testsuite/c-c++-common/gomp/defaultmap-3.c     |  6 +++---
 gcc/testsuite/c-c++-common/gomp/order-4.c          |  8 ++++----
 gcc/testsuite/g++.dg/gomp/parallel-2.C             |  4 ++--
 gcc/testsuite/g++.dg/gomp/predetermined-1.C        | 14 +++++++-------
 gcc/testsuite/g++.dg/gomp/sharing-1.C              |  2 +-
 gcc/testsuite/gcc.dg/gomp/appendix-a/a.24.1.c      |  2 +-
 gcc/testsuite/gcc.dg/gomp/parallel-2.c             |  4 ++--
 gcc/testsuite/gcc.dg/gomp/pr44085.c                |  2 +-
 gcc/testsuite/gcc.dg/gomp/sharing-1.c              |  2 +-
 gcc/testsuite/gcc.dg/gomp/vla-1.c                  |  2 +-
 .../gfortran.dg/gomp/appendix-a/a.24.1.f90         |  2 +-
 gcc/testsuite/gfortran.dg/gomp/crayptr3.f90        |  2 +-
 gcc/testsuite/gfortran.dg/gomp/pr33439.f90         |  7 ++++---
 gcc/testsuite/gfortran.dg/gomp/pr44036-1.f90       |  4 ++--
 gcc/testsuite/gfortran.dg/gomp/pr44085.f90         |  2 +-
 gcc/testsuite/gfortran.dg/gomp/pr44536.f90         |  2 +-
 gcc/testsuite/gfortran.dg/gomp/sharing-1.f90       |  2 +-
 gcc/testsuite/gfortran.dg/gomp/sharing-2.f90       | 10 +++++-----
 gcc/testsuite/gfortran.dg/gomp/sharing-3.f90       |  2 +-
 21 files changed, 49 insertions(+), 48 deletions(-)

diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 2f2c51b2d894..eaff5ae9e7eb 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -7100,13 +7100,13 @@  omp_notice_threadprivate_variable (struct gimplify_omp_ctx *ctx, tree decl,
 	      {
 		error ("threadprivate variable %qE used in a region with"
 		       " %<order(concurrent)%> clause", DECL_NAME (decl));
-		error_at (octx->location, "enclosing region");
+		inform (octx->location, "enclosing region");
 	      }
 	    else
 	      {
 		error ("threadprivate variable %qE used in target region",
 		       DECL_NAME (decl));
-		error_at (octx->location, "enclosing target region");
+		inform (octx->location, "enclosing target region");
 	      }
 	    splay_tree_insert (octx->variables, (splay_tree_key)decl, 0);
 	  }
@@ -7121,7 +7121,7 @@  omp_notice_threadprivate_variable (struct gimplify_omp_ctx *ctx, tree decl,
     {
       error ("threadprivate variable %qE used in untied task",
 	     DECL_NAME (decl));
-      error_at (ctx->location, "enclosing task");
+      inform (ctx->location, "enclosing task");
       splay_tree_insert (ctx->variables, (splay_tree_key)decl, 0);
     }
   if (decl2)
@@ -7199,7 +7199,7 @@  omp_default_clause (struct gimplify_omp_ctx *ctx, tree decl,
 	
 	error ("%qE not specified in enclosing %qs",
 	       DECL_NAME (lang_hooks.decls.omp_report_decl (decl)), rtype);
-	error_at (ctx->location, "enclosing %qs", rtype);
+	inform (ctx->location, "enclosing %qs", rtype);
       }
       /* FALLTHRU */
     case OMP_CLAUSE_DEFAULT_SHARED:
@@ -7469,7 +7469,7 @@  omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code)
 		      tree d = lang_hooks.decls.omp_report_decl (decl);
 		      error ("%qE not specified in enclosing %<target%>",
 			     DECL_NAME (d));
-		      error_at (ctx->location, "enclosing %<target%>");
+		      inform (ctx->location, "enclosing %<target%>");
 		    }
 		  else if (ctx->defaultmap[gdmk]
 			   & (GOVD_MAP_0LEN_ARRAY | GOVD_FIRSTPRIVATE))
diff --git a/gcc/testsuite/c-c++-common/gomp/default-1.c b/gcc/testsuite/c-c++-common/gomp/default-1.c
index 6525483c44e7..eab46892dada 100644
--- a/gcc/testsuite/c-c++-common/gomp/default-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/default-1.c
@@ -2,20 +2,20 @@  void
 foo (void)
 {
   int x = 0, i;
-  #pragma omp task default(none)	/* { dg-error "enclosing 'task'" } */
+  #pragma omp task default(none)	/* { dg-message "note: enclosing 'task'" } */
   {
     x++;	/* { dg-error "'x' not specified in enclosing 'task'" } */
   }
-  #pragma omp taskloop default(none)	/* { dg-error "enclosing 'taskloop'" } */
+  #pragma omp taskloop default(none)	/* { dg-message "note: enclosing 'taskloop'" } */
   for (i = 0; i < 64; i++)
     {
       x++;	/* { dg-error "'x' not specified in enclosing 'taskloop'" } */
     }
-  #pragma omp teams default(none)	/* { dg-error "enclosing 'teams'" } */
+  #pragma omp teams default(none)	/* { dg-message "note: enclosing 'teams'" } */
   {
     x++;	/* { dg-error "'x' not specified in enclosing 'teams'" } */
   }
-  #pragma omp parallel default(none)	/* { dg-error "enclosing 'parallel'" } */
+  #pragma omp parallel default(none)	/* { dg-message "note: enclosing 'parallel'" } */
   {
     x++;	/* { dg-error "'x' not specified in enclosing 'parallel'" } */
   }
diff --git a/gcc/testsuite/c-c++-common/gomp/defaultmap-3.c b/gcc/testsuite/c-c++-common/gomp/defaultmap-3.c
index 2f5b303958f4..8be23fd14735 100644
--- a/gcc/testsuite/c-c++-common/gomp/defaultmap-3.c
+++ b/gcc/testsuite/c-c++-common/gomp/defaultmap-3.c
@@ -11,7 +11,7 @@  f1 (int sc1, struct S ag1, int *pt1)
 {
   char ar1[N];
   foo (ar1);
-  #pragma omp target defaultmap(default:scalar) defaultmap(to:aggregate) defaultmap(none:pointer)	/* { dg-error "enclosing 'target'" } */
+  #pragma omp target defaultmap(default:scalar) defaultmap(to:aggregate) defaultmap(none:pointer)	/* { dg-message "note: enclosing 'target'" } */
   bar (sc1, ar1, ag1, pt1);	/* { dg-error "'pt1' not specified in enclosing 'target'" } */
 }
 
@@ -20,7 +20,7 @@  f2 (int sc2, struct S ag2, int *pt2)
 {
   char ar2[N];
   foo (ar2);
-  #pragma omp target defaultmap(none:scalar) defaultmap(from:aggregate) defaultmap(default:pointer)	/* { dg-error "enclosing 'target'" } */
+  #pragma omp target defaultmap(none:scalar) defaultmap(from:aggregate) defaultmap(default:pointer)	/* { dg-message "note: enclosing 'target'" } */
   bar (sc2, ar2, ag2, pt2);	/* { dg-error "'sc2' not specified in enclosing 'target'" } */
 }
 
@@ -29,6 +29,6 @@  f3 (int sc3, struct S ag3, int *pt3)
 {
   char ar3[N];
   foo (ar3);
-  #pragma omp target defaultmap(firstprivate:scalar) defaultmap(none:aggregate) defaultmap(to:pointer)	/* { dg-error "enclosing 'target'" } */
+  #pragma omp target defaultmap(firstprivate:scalar) defaultmap(none:aggregate) defaultmap(to:pointer)	/* { dg-message "note: enclosing 'target'" } */
   bar (sc3, ar3, ag3, pt3);	/* { dg-error "'ar3' not specified in enclosing 'target'" } */
 }				/* { dg-error "'ag3' not specified in enclosing 'target'" "" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/c-c++-common/gomp/order-4.c b/gcc/testsuite/c-c++-common/gomp/order-4.c
index f916772ceea7..d1109bb13b3b 100644
--- a/gcc/testsuite/c-c++-common/gomp/order-4.c
+++ b/gcc/testsuite/c-c++-common/gomp/order-4.c
@@ -5,7 +5,7 @@  void
 f1 (void)
 {
   int i;
-  #pragma omp simd order(concurrent)	/* { dg-error "enclosing region" } */
+  #pragma omp simd order(concurrent)	/* { dg-message "note: enclosing region" } */
   for (i = 0; i < 64; i++)
     t++;	/* { dg-error "threadprivate variable 't' used in a region with 'order\\(concurrent\\)' clause" } */
 }
@@ -14,8 +14,8 @@  void
 f2 (void)
 {
   int i;
-  #pragma omp for simd order(concurrent)	/* { dg-error "enclosing region" } */
-  for (i = 0; i < 64; i++)			/* { dg-error "enclosing region" "" { target c++ } } */
+  #pragma omp for simd order(concurrent)	/* { dg-message "note: enclosing region" } */
+  for (i = 0; i < 64; i++)			/* { dg-message "note: enclosing region" "" { target c++ } } */
     t++;	/* { dg-error "threadprivate variable 't' used in a region with 'order\\(concurrent\\)' clause" } */
 }
 
@@ -23,7 +23,7 @@  void
 f3 (void)
 {
   int i;
-  #pragma omp for order(concurrent)	/* { dg-error "enclosing region" } */
+  #pragma omp for order(concurrent)	/* { dg-message "note: enclosing region" } */
   for (i = 0; i < 64; i++)
     t++;	/* { dg-error "threadprivate variable 't' used in a region with 'order\\(concurrent\\)' clause" } */
 }
diff --git a/gcc/testsuite/g++.dg/gomp/parallel-2.C b/gcc/testsuite/g++.dg/gomp/parallel-2.C
index 68e577766b1f..38875ad94ed6 100644
--- a/gcc/testsuite/g++.dg/gomp/parallel-2.C
+++ b/gcc/testsuite/g++.dg/gomp/parallel-2.C
@@ -4,11 +4,11 @@  void foo()
 {
   int i;
 
-  #pragma omp parallel default(none)		// { dg-error "enclosing" }
+  #pragma omp parallel default(none)		// { dg-message "note: enclosing 'parallel'" }
     {
     #pragma omp parallel
       {
-      #pragma omp parallel default(none)	// { dg-error "enclosing" }
+      #pragma omp parallel default(none)	// { dg-message "note: enclosing 'parallel'" }
         {
  	  i++;					// { dg-error "not specified" }
 	}
diff --git a/gcc/testsuite/g++.dg/gomp/predetermined-1.C b/gcc/testsuite/g++.dg/gomp/predetermined-1.C
index 084f04ec90f2..74cd74febdfb 100644
--- a/gcc/testsuite/g++.dg/gomp/predetermined-1.C
+++ b/gcc/testsuite/g++.dg/gomp/predetermined-1.C
@@ -15,19 +15,19 @@  const A foo (const A d, const C e)
   const A f;
   const B b = { 4 };
   A g;
-  #pragma omp parallel default (none)	// { dg-error "enclosing 'parallel'" }
+  #pragma omp parallel default (none)	// { dg-message "note: enclosing 'parallel'" }
     bar (&a);				// { dg-error "not specified" }
-  #pragma omp parallel default (none)	// { dg-error "enclosing 'parallel'" }
+  #pragma omp parallel default (none)	// { dg-message "note: enclosing 'parallel'" }
     bar (&b);				// { dg-error "not specified" }
-  #pragma omp parallel default (none)	// { dg-error "enclosing 'parallel'" }
+  #pragma omp parallel default (none)	// { dg-message "note: enclosing 'parallel'" }
     bar (&c);				// { dg-error "not specified" }
-  #pragma omp parallel default (none)	// { dg-error "enclosing 'parallel'" }
+  #pragma omp parallel default (none)	// { dg-message "note: enclosing 'parallel'" }
     bar (&d);				// { dg-error "not specified" }
-  #pragma omp parallel default (none)	// { dg-error "enclosing 'parallel'" }
+  #pragma omp parallel default (none)	// { dg-message "note: enclosing 'parallel'" }
     bar (&e);				// { dg-error "not specified" }
-  #pragma omp parallel default (none)	// { dg-error "enclosing 'parallel'" }
+  #pragma omp parallel default (none)	// { dg-message "note: enclosing 'parallel'" }
     bar (&f);				// { dg-error "not specified" }
-  #pragma omp parallel default (none)	// { dg-error "enclosing 'parallel'" }
+  #pragma omp parallel default (none)	// { dg-message "note: enclosing 'parallel'" }
     bar (&g);				// { dg-error "not specified" }
   return f;
 }
diff --git a/gcc/testsuite/g++.dg/gomp/sharing-1.C b/gcc/testsuite/g++.dg/gomp/sharing-1.C
index ac6908b68ac5..4506170c2471 100644
--- a/gcc/testsuite/g++.dg/gomp/sharing-1.C
+++ b/gcc/testsuite/g++.dg/gomp/sharing-1.C
@@ -52,7 +52,7 @@  main (void)
   *p = 7;
   s = 6;
   l = 0;
-#pragma omp parallel for /* { dg-error "enclosing 'parallel'" } */ \
+#pragma omp parallel for /* { dg-message "note: enclosing 'parallel'" } */ \
   default (none) private (p) shared (s) 
   for (i = 0; i < 64; i++)
     {
diff --git a/gcc/testsuite/gcc.dg/gomp/appendix-a/a.24.1.c b/gcc/testsuite/gcc.dg/gomp/appendix-a/a.24.1.c
index 099f03fe89d3..47b2511508e4 100644
--- a/gcc/testsuite/gcc.dg/gomp/appendix-a/a.24.1.c
+++ b/gcc/testsuite/gcc.dg/gomp/appendix-a/a.24.1.c
@@ -21,7 +21,7 @@  a24 (int a)
 					      is listed in shared clause */
     z[i] = y;
     /* { dg-error "'i' not specified" "" { target *-*-* } .-1 } */
-    /* { dg-error "enclosing 'parallel'" "" { target *-*-* } omp_parallel } */
+    /* { dg-message "note: enclosing 'parallel'" "" { target *-*-* } omp_parallel } */
     /* { dg-error "'y' not specified" "" { target *-*-* } .-3 }  */
 #pragma omp for firstprivate(y)
     for (i = 0; i < 10; i++)
diff --git a/gcc/testsuite/gcc.dg/gomp/parallel-2.c b/gcc/testsuite/gcc.dg/gomp/parallel-2.c
index 68e577766b1f..b2d653db9e2a 100644
--- a/gcc/testsuite/gcc.dg/gomp/parallel-2.c
+++ b/gcc/testsuite/gcc.dg/gomp/parallel-2.c
@@ -4,11 +4,11 @@  void foo()
 {
   int i;
 
-  #pragma omp parallel default(none)		// { dg-error "enclosing" }
+  #pragma omp parallel default(none)		// { dg-message "note: enclosing 'parallel'" }
     {
     #pragma omp parallel
       {
-      #pragma omp parallel default(none)	// { dg-error "enclosing" }
+      #pragma omp parallel default(none)	// { dg-message: "note: enclosing 'parallel'" }
         {
  	  i++;					// { dg-error "not specified" }
 	}
diff --git a/gcc/testsuite/gcc.dg/gomp/pr44085.c b/gcc/testsuite/gcc.dg/gomp/pr44085.c
index 55462abe504e..3f3441bde88c 100644
--- a/gcc/testsuite/gcc.dg/gomp/pr44085.c
+++ b/gcc/testsuite/gcc.dg/gomp/pr44085.c
@@ -9,7 +9,7 @@  int thr1, thr2;
 void
 foo (void)
 {
-#pragma omp task untied	/* { dg-error "enclosing task" } */
+#pragma omp task untied	/* { dg-message "note: enclosing task" } */
   {
     thr1++;		/* { dg-error "used in untied task" } */
     thr2 |= 4;		/* { dg-error "used in untied task" } */
diff --git a/gcc/testsuite/gcc.dg/gomp/sharing-1.c b/gcc/testsuite/gcc.dg/gomp/sharing-1.c
index 79abb64cdd7f..2c6b01779d18 100644
--- a/gcc/testsuite/gcc.dg/gomp/sharing-1.c
+++ b/gcc/testsuite/gcc.dg/gomp/sharing-1.c
@@ -35,7 +35,7 @@  main (void)
   *p = 7;
   s = 6;
   l = 0;
-#pragma omp parallel for /* { dg-error "enclosing 'parallel'" } */ \
+#pragma omp parallel for /* { dg-message "note: enclosing 'parallel'" } */ \
   default (none) private (p) shared (s) 
   for (i = 0; i < 64; i++)
     {
diff --git a/gcc/testsuite/gcc.dg/gomp/vla-1.c b/gcc/testsuite/gcc.dg/gomp/vla-1.c
index bb37f33e60f7..dd42b9a07521 100644
--- a/gcc/testsuite/gcc.dg/gomp/vla-1.c
+++ b/gcc/testsuite/gcc.dg/gomp/vla-1.c
@@ -4,7 +4,7 @@  void foo(int n)
 {
   int A[n];
 
-  #pragma omp parallel default(none)	// { dg-error "enclosing" }
+  #pragma omp parallel default(none)	// { dg-message "note: enclosing 'parallel'" }
     {
       A[0] = 0;				// { dg-error "'A' not specified" }
     }
diff --git a/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.24.1.f90 b/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.24.1.f90
index 52a2cbb82da9..3837aab6cca7 100644
--- a/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.24.1.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.24.1.f90
@@ -19,7 +19,7 @@ 
       X=1      ! O.K. - X is THREADPRIVATE
       Z(I) = Y ! Error - cannot reference I or Y here
 ! { dg-error "'i' not specified" "" { target *-*-* } .-1 } */
-! { dg-error "enclosing 'parallel'" "" { target *-*-* } omp_parallel } */
+! { dg-message "note: enclosing 'parallel'" "" { target *-*-* } omp_parallel } */
 ! { dg-error "'y' not specified" "" { target *-*-* } .-3 }  */
 !$OMP DO firstprivate(y)
       DO I = 1,10
diff --git a/gcc/testsuite/gfortran.dg/gomp/crayptr3.f90 b/gcc/testsuite/gfortran.dg/gomp/crayptr3.f90
index 15bf864997f4..9a28bbc3cf23 100644
--- a/gcc/testsuite/gfortran.dg/gomp/crayptr3.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/crayptr3.f90
@@ -16,7 +16,7 @@ 
   a = 1
 !$omp end parallel
 
-!$omp parallel default (none)	! { dg-error "enclosing 'parallel'" }
+!$omp parallel default (none)	! { dg-message "note: enclosing 'parallel'" }
   a = 1		! { dg-error "'ip' not specified in enclosing 'parallel'" }
 !$omp end parallel
 end
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr33439.f90 b/gcc/testsuite/gfortran.dg/gomp/pr33439.f90
index 42fa22184b34..12a73d22d1af 100644
--- a/gcc/testsuite/gfortran.dg/gomp/pr33439.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/pr33439.f90
@@ -5,7 +5,7 @@ 
 subroutine pr33439_1
   integer :: s, i
   s = 4
-!$omp parallel default(none)	! { dg-error "enclosing 'parallel'" }
+!$omp parallel default(none)	! { dg-message "note: enclosing 'parallel'" }
   call somethingelse
 !$omp do schedule(static, s)	! { dg-error "not specified in enclosing 'parallel'" }
   do i = 1, 8
@@ -18,7 +18,7 @@  end subroutine pr33439_1
 subroutine pr33439_2
   integer :: s, i
   s = 4
-!$omp parallel default(none)	! { dg-error "enclosing 'parallel'" }
+!$omp parallel default(none)	! { dg-message "note: enclosing 'parallel'" }
 !$omp do schedule(static, s)	! { dg-error "not specified in enclosing 'parallel'" }
   do i = 1, 8
     call something
@@ -30,7 +30,8 @@  end subroutine pr33439_2
 subroutine pr33439_3
   integer :: s, i
   s = 4
-!$omp parallel do default(none) schedule(static, s) ! { dg-error "enclosing 'parallel'" }
+!$omp parallel do default(none) schedule(static, s)	! { dg-message "note: enclosing 'parallel'" }
+!							! { dg-error "'s' not specified in enclosing 'parallel'" "" { target *-*-* } .-1 }
   do i = 1, 8
     call something
   end do
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr44036-1.f90 b/gcc/testsuite/gfortran.dg/gomp/pr44036-1.f90
index 1caa93df8c3d..ef90d1326536 100644
--- a/gcc/testsuite/gfortran.dg/gomp/pr44036-1.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/pr44036-1.f90
@@ -11,14 +11,14 @@  subroutine foo(a, b)
 !$omp parallel default(none) private (x)
   x = a(4)
 !$omp end parallel
-!$omp parallel default(none) private (x)	! { dg-error "enclosing 'parallel'" }
+!$omp parallel default(none) private (x)	! { dg-message "note: enclosing 'parallel'" }
   x = b(5)					! { dg-error "not specified in" }
 !$omp end parallel
 !$omp parallel default(none) private (x)
   x = c(6)
 !$omp end parallel
   d => a
-!$omp parallel default(none) private (x)	! { dg-error "enclosing 'parallel'" }
+!$omp parallel default(none) private (x)	! { dg-message "note: enclosing 'parallel'" }
   x = d(7)					! { dg-error "not specified in" }
 !$omp end parallel
 end
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr44085.f90 b/gcc/testsuite/gfortran.dg/gomp/pr44085.f90
index db8fbbc9544f..90094d6ef47e 100644
--- a/gcc/testsuite/gfortran.dg/gomp/pr44085.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/pr44085.f90
@@ -8,7 +8,7 @@ 
   common /thrs/ thr3, thr4
 !$omp threadprivate (thr1, thr2, /thrs/)
 
-!$omp task untied		! { dg-error "enclosing task" }
+!$omp task untied		! { dg-message "note: enclosing task" }
   thr1 = thr1 + 1		! { dg-error "used in untied task" }
   thr2 = thr2 + 2		! { dg-error "used in untied task" }
   thr3 = thr3 + 3		! { dg-error "used in untied task" }
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr44536.f90 b/gcc/testsuite/gfortran.dg/gomp/pr44536.f90
index 4fcf5d1102b6..c1d83cdeae51 100644
--- a/gcc/testsuite/gfortran.dg/gomp/pr44536.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/pr44536.f90
@@ -4,7 +4,7 @@ 
       subroutine foo (a, i, j)
         integer, dimension(:) :: a
         integer :: i, j
-!$omp parallel default(none) shared(i, j)	! { dg-error "enclosing 'parallel'" }
+!$omp parallel default(none) shared(i, j)	! { dg-message "note: enclosing 'parallel'" }
         j=a(i)					! { dg-error "not specified in" }
 !$omp end parallel
       end subroutine
diff --git a/gcc/testsuite/gfortran.dg/gomp/sharing-1.f90 b/gcc/testsuite/gfortran.dg/gomp/sharing-1.f90
index ad9149ebe39d..f4958b81d6ce 100644
--- a/gcc/testsuite/gfortran.dg/gomp/sharing-1.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/sharing-1.f90
@@ -9,7 +9,7 @@ 
 !$omp threadprivate (/thrblk/, thrpriv)
   s = 1
 !$omp parallel do default (none) &
-!$omp & private (p) shared (s) ! { dg-error "enclosing 'parallel'" }
+!$omp & private (p) shared (s) ! { dg-message "note: enclosing 'parallel'" }
   do i = 1, 64
     call foo (thrpriv)	! Predetermined - threadprivate
     call foo (thr)	! Predetermined - threadprivate
diff --git a/gcc/testsuite/gfortran.dg/gomp/sharing-2.f90 b/gcc/testsuite/gfortran.dg/gomp/sharing-2.f90
index bf5519070d44..acc8d37771c7 100644
--- a/gcc/testsuite/gfortran.dg/gomp/sharing-2.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/sharing-2.f90
@@ -9,7 +9,7 @@ 
     j = 8
   end do
 !$omp end parallel do
-!$omp parallel default (none) shared (a) ! { dg-error "enclosing 'parallel'" }
+!$omp parallel default (none) shared (a) ! { dg-message "note: enclosing 'parallel'" }
   i = 1
   j = 1
   k = 1
@@ -28,7 +28,7 @@ 
   end do
 !$omp end single
 !$omp end parallel
-!$omp parallel default (none) shared (a) ! { dg-error "enclosing 'parallel'" }
+!$omp parallel default (none) shared (a) ! { dg-message "note: enclosing 'parallel'" }
   i = 1		! { dg-error "not specified in" }
   j = 1		! { dg-error "not specified in" }
   k = 1		! { dg-error "not specified in" }
@@ -54,21 +54,21 @@ 
   j = 1
   k = 1
 !$omp end parallel
-!$omp parallel default (none) shared (a) ! { dg-error "enclosing 'parallel'" }
+!$omp parallel default (none) shared (a) ! { dg-message "note: enclosing 'parallel'" }
   i = 1		! { dg-error "not specified in" }
 !$omp do
   do i = 1, 10
     a(i, 1) = i + 1
   end do
 !$omp end parallel
-!$omp parallel default (none) shared (a) ! { dg-error "enclosing 'parallel'" }
+!$omp parallel default (none) shared (a) ! { dg-message "note: enclosing 'parallel'" }
   i = 1		! { dg-error "not specified in" }
 !$omp parallel do default (none) shared (a)
   do i = 1, 10
     a(i, 1) = i + 1
   end do
 !$omp end parallel
-!$omp parallel default (none) shared (a) ! { dg-error "enclosing 'parallel'" }
+!$omp parallel default (none) shared (a) ! { dg-message "note: enclosing 'parallel'" }
   i = 1		! { dg-error "not specified in" }
 !$omp parallel default (none) shared (a, i)
   i = 2
diff --git a/gcc/testsuite/gfortran.dg/gomp/sharing-3.f90 b/gcc/testsuite/gfortran.dg/gomp/sharing-3.f90
index 221ec0023712..a9abc7b5a333 100644
--- a/gcc/testsuite/gfortran.dg/gomp/sharing-3.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/sharing-3.f90
@@ -25,7 +25,7 @@  subroutine foo (vara, varb, varc, vard, n)
     vard(1) = 1
     vare(1) = 1
   !$omp end parallel
-  !$omp parallel default(none)	! { dg-error "enclosing 'parallel'" }
+  !$omp parallel default(none)	! { dg-message "note: enclosing 'parallel'" }
     !$omp master
       vara(1) = 1		! { dg-error "not specified" }
       varb(1) = 1		! Assumed-size is predetermined
-- 
2.26.2