From baf13b7df78e37ae59084c6b6ebf9dcfd0995862 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Wed, 25 Nov 2020 10:45:47 +0100
Subject: [PATCH] Add 'g++.dg/gomp/map-{1,2}.C'

	gcc/testsuite/
	* g++.dg/gomp/map-1.C: New.
	* g++.dg/gomp/map-2.C: Likewise.
---
 gcc/testsuite/c-c++-common/gomp/map-1.c                |  5 +++--
 gcc/testsuite/c-c++-common/gomp/map-2.c                |  5 +++--
 .../{c-c++-common/gomp/map-1.c => g++.dg/gomp/map-1.C} | 10 ++++++----
 .../{c-c++-common/gomp/map-2.c => g++.dg/gomp/map-2.C} |  6 ++++--
 4 files changed, 16 insertions(+), 10 deletions(-)
 copy gcc/testsuite/{c-c++-common/gomp/map-1.c => g++.dg/gomp/map-1.C} (95%)
 copy gcc/testsuite/{c-c++-common/gomp/map-2.c => g++.dg/gomp/map-2.C} (93%)

diff --git a/gcc/testsuite/c-c++-common/gomp/map-1.c b/gcc/testsuite/c-c++-common/gomp/map-1.c
index 508dc8d6b01..31100b0396b 100644
--- a/gcc/testsuite/c-c++-common/gomp/map-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/map-1.c
@@ -1,5 +1,6 @@
-/* { dg-do compile } */
-/* { dg-options "-fopenmp" } */
+/* Test 'map' clause diagnostics.  */
+
+/* See also corresponding C++ variant: '../../g++.dg/gomp/map-1.C'.  */
 
 extern int a[][10], a2[][10];
 int b[10], c[10][2], d[10], e[10], f[10];
diff --git a/gcc/testsuite/c-c++-common/gomp/map-2.c b/gcc/testsuite/c-c++-common/gomp/map-2.c
index 101f4047b85..cd69f6b9a57 100644
--- a/gcc/testsuite/c-c++-common/gomp/map-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/map-2.c
@@ -1,5 +1,6 @@
-/* { dg-do compile } */
-/* { dg-options "-fopenmp" } */
+/* Test 'map' clause diagnostics.  */
+
+/* See also corresponding C++ variant: '../../g++.dg/gomp/map-2.C'.  */
 
 void
 foo (int *p, int (*q)[10], int r[10], int s[10][10])
diff --git a/gcc/testsuite/c-c++-common/gomp/map-1.c b/gcc/testsuite/g++.dg/gomp/map-1.C
similarity index 95%
copy from gcc/testsuite/c-c++-common/gomp/map-1.c
copy to gcc/testsuite/g++.dg/gomp/map-1.C
index 508dc8d6b01..be9aca1a9fb 100644
--- a/gcc/testsuite/c-c++-common/gomp/map-1.c
+++ b/gcc/testsuite/g++.dg/gomp/map-1.C
@@ -1,5 +1,6 @@
-/* { dg-do compile } */
-/* { dg-options "-fopenmp" } */
+/* Test data clause diagnostics.  */
+
+/* See also corresponding C/C++ variant: '../../c-c++-common/gomp/map-1.c'.  */
 
 extern int a[][10], a2[][10];
 int b[10], c[10][2], d[10], e[10], f[10];
@@ -16,11 +17,12 @@ int t[10];
 void bar (int *);
 #pragma omp end declare target
 
+template <int N>
 void
 foo (int g[3][10], int h[4][8], int i[2][10], int j[][9],
      int g2[3][10], int h2[4][8], int i2[2][10], int j2[][9])
 {
-  #pragma omp target map(to: bar[2:5]) /* { dg-error "is not a variable" } */
+  #pragma omp target map(to: bar[2:5]) /* { dg-error "is not a variable" "TODO" { xfail *-*-* } } */
     ;
   #pragma omp target map(from: t[2:5]) /* { dg-error "is threadprivate variable" } */
     ;
@@ -39,7 +41,7 @@ foo (int g[3][10], int h[4][8], int i[2][10], int j[][9],
   #pragma omp target map(alloc: s2) /* { dg-error "'s2' does not have a mappable type in 'map' clause" } */
     ;
   #pragma omp target map(to: a[:][:]) /* { dg-error "array type length expression must be specified" } */
-    bar (&a[0][0]); /* { dg-error "referenced in target region does not have a mappable type" } */
+    bar (&a[0][0]); /* { dg-error "referenced in target region does not have a mappable type" "TODO" { xfail *-*-* } } */
   #pragma omp target map(tofrom: b[-1:]) /* { dg-error "negative low bound in array section" } */
     bar (b);
   #pragma omp target map(tofrom: c[:-3][:]) /* { dg-error "negative length in array section" } */
diff --git a/gcc/testsuite/c-c++-common/gomp/map-2.c b/gcc/testsuite/g++.dg/gomp/map-2.C
similarity index 93%
copy from gcc/testsuite/c-c++-common/gomp/map-2.c
copy to gcc/testsuite/g++.dg/gomp/map-2.C
index 101f4047b85..7fdd61c4998 100644
--- a/gcc/testsuite/c-c++-common/gomp/map-2.c
+++ b/gcc/testsuite/g++.dg/gomp/map-2.C
@@ -1,6 +1,8 @@
-/* { dg-do compile } */
-/* { dg-options "-fopenmp" } */
+/* Test data clause diagnostics.  */
 
+/* See also corresponding C/C++ variant: '../../c-c++-common/gomp/map-2.c'.  */
+
+template <int N>
 void
 foo (int *p, int (*q)[10], int r[10], int s[10][10])
 {
-- 
2.17.1

