[OG9,committed] Backport error message for mapped parameters

Message ID bec2d388-f28f-c853-1e0d-a2089362ac48@codesourcery.com
State New
Headers show
Series
  • [OG9,committed] Backport error message for mapped parameters
Related show

Commit Message

Andrew Stubbs Sept. 6, 2019, 1:55 p.m.
I've backported this patch from mainline.

Andrew

Patch

Tweak error message for mapped parameters.

2019-07-05  Andrew Stubbs  <ams@codesourcery.com>

	gcc/fortran/
	* openmp.c (resolve_omp_clauses): Add custom error messages for
	parameters in map clauses.

diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index 1c7bce6c300..44fcb9db8c6 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -4208,8 +4208,21 @@  resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
 		  continue;
 	      }
 	  }
-	gfc_error ("Object %qs is not a variable at %L", n->sym->name,
-		   &n->where);
+	if (list == OMP_LIST_MAP
+	    && n->sym->attr.flavor == FL_PARAMETER)
+	  {
+	    if (openacc)
+	      gfc_error ("Object %qs is not a variable at %L; parameters"
+			 " cannot be and need not be copied", n->sym->name,
+			 &n->where);
+	    else
+	      gfc_error ("Object %qs is not a variable at %L; parameters"
+			 " cannot be and need not be mapped", n->sym->name,
+			 &n->where);
+	  }
+	else
+	  gfc_error ("Object %qs is not a variable at %L", n->sym->name,
+		     &n->where);
       }
 
   for (list = 0; list < OMP_LIST_NUM; list++)