Hi!

On 2020-11-25T11:52:44+0100, Jakub Jelinek <ja...@redhat.com> wrote:
> On Wed, Nov 25, 2020 at 11:43:48AM +0100, Thomas Schwinge wrote:
>> On 2020-11-25T11:10:18+0100, Jakub Jelinek <ja...@redhat.com> wrote:
>> > On Wed, Nov 25, 2020 at 11:00:57AM +0100, Thomas Schwinge wrote:
>> >> I had reason to look into OpenMP C++ 'map' clause parsing, and a
>> >> testsuite enhancement to "Add 'g++.dg/gomp/map-{1,2}.C'" fell out of
>> >> that, see attached.  OK to push?
>> >>
>> >> Note two XFAILs in 'g++.dg/gomp/map-1.C' compared to the C/C++ variant.

>> [...] the first XFAIL disappears (now matches the C/C++ variant),
>> but the second remains, see updated patch attached.
>
> Ok, patch ok for trunk.

I've pushed "Add 'g++.dg/gomp/map-{1,2}.C'" to master branch in commit
1049e5408fa343b5bf0a6380212a8ec8dfe2b6fc, and backported to
releases/gcc-10 branch in commit
78853078d692809807f44348948041c5fbe2588d, to releases/gcc-9 branch in
commit a03fa173f60c66889f84da947a62f5b1b42cdf07, to releases/gcc-8 branch
in commit e7e0360147d973e7634f16bfec265cd4cc937e1c, see attached.  (All
branches, as I need this later in context of an OpenACC-specific bug
fix.)

> If you could file a PR for the TODO xfail, I'd appreciate it.

<https://gcc.gnu.org/PR97996> "[OMP] Missing 'omp_mappable_type' error
diagnostic inside C++ template".  Unfortunately, I failed to replace
"TODO" with "PR97996" before pushing.


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 1049e5408fa343b5bf0a6380212a8ec8dfe2b6fc Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <tho...@codesourcery.com>
Date: Wed, 25 Nov 2020 11:41:45 +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.
	* c-c++-common/gomp/map-1.c: Adjust.
	* c-c++-common/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 +++--
 .../gomp/map-1.c => g++.dg/gomp/map-1.C}           | 14 +++++++++++---
 .../gomp/map-2.c => g++.dg/gomp/map-2.C}           | 12 ++++++++++--
 4 files changed, 27 insertions(+), 9 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} (91%)

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..11275efff4a 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 'map' 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,6 +17,7 @@ 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])
@@ -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" } */
@@ -107,3 +109,9 @@ foo (int g[3][10], int h[4][8], int i[2][10], int j[][9],
   #pragma omp target map(r[3:][2:1][1:2][:][:3]) /* { dg-error "array section is not contiguous" } */
     ;
 }
+
+static void
+instantiate ()
+{
+  &foo<0>;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/map-2.c b/gcc/testsuite/g++.dg/gomp/map-2.C
similarity index 91%
copy from gcc/testsuite/c-c++-common/gomp/map-2.c
copy to gcc/testsuite/g++.dg/gomp/map-2.C
index 101f4047b85..10eaaa948b8 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 'map' 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])
 {
@@ -42,3 +44,9 @@ foo (int *p, int (*q)[10], int r[10], int s[10][10])
   #pragma omp target map (tofrom: b[2:5][0:-4]) /* { dg-error "negative length in array section in" } */
   ;
 }
+
+static void
+instantiate ()
+{
+  &foo<0>;
+}
-- 
2.17.1

>From 78853078d692809807f44348948041c5fbe2588d Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <tho...@codesourcery.com>
Date: Wed, 25 Nov 2020 11:41:45 +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.
	* c-c++-common/gomp/map-1.c: Adjust.
	* c-c++-common/gomp/map-2.c: Likewise.

(cherry picked from commit 1049e5408fa343b5bf0a6380212a8ec8dfe2b6fc)
---
 gcc/testsuite/c-c++-common/gomp/map-1.c            |  5 +++--
 gcc/testsuite/c-c++-common/gomp/map-2.c            |  5 +++--
 .../gomp/map-1.c => g++.dg/gomp/map-1.C}           | 14 +++++++++++---
 .../gomp/map-2.c => g++.dg/gomp/map-2.C}           | 12 ++++++++++--
 4 files changed, 27 insertions(+), 9 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} (91%)

diff --git a/gcc/testsuite/c-c++-common/gomp/map-1.c b/gcc/testsuite/c-c++-common/gomp/map-1.c
index 5dad7d6a9aa..cd026f1243f 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 5dad7d6a9aa..107b59ee87a 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 'map' 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,6 +17,7 @@ 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])
@@ -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" } */
@@ -107,3 +109,9 @@ foo (int g[3][10], int h[4][8], int i[2][10], int j[][9],
   #pragma omp target map(r[3:][2:1][1:2][:][:3]) /* { dg-error "array section is not contiguous" } */
     ;
 }
+
+static void
+instantiate ()
+{
+  &foo<0>;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/map-2.c b/gcc/testsuite/g++.dg/gomp/map-2.C
similarity index 91%
copy from gcc/testsuite/c-c++-common/gomp/map-2.c
copy to gcc/testsuite/g++.dg/gomp/map-2.C
index 101f4047b85..10eaaa948b8 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 'map' 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])
 {
@@ -42,3 +44,9 @@ foo (int *p, int (*q)[10], int r[10], int s[10][10])
   #pragma omp target map (tofrom: b[2:5][0:-4]) /* { dg-error "negative length in array section in" } */
   ;
 }
+
+static void
+instantiate ()
+{
+  &foo<0>;
+}
-- 
2.17.1

>From a03fa173f60c66889f84da947a62f5b1b42cdf07 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <tho...@codesourcery.com>
Date: Wed, 25 Nov 2020 11:41:45 +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.
	* c-c++-common/gomp/map-1.c: Adjust.
	* c-c++-common/gomp/map-2.c: Likewise.

(cherry picked from commit 1049e5408fa343b5bf0a6380212a8ec8dfe2b6fc)
---
 gcc/testsuite/c-c++-common/gomp/map-1.c            |  5 +++--
 gcc/testsuite/c-c++-common/gomp/map-2.c            |  5 +++--
 .../gomp/map-1.c => g++.dg/gomp/map-1.C}           | 14 +++++++++++---
 .../gomp/map-2.c => g++.dg/gomp/map-2.C}           | 12 ++++++++++--
 4 files changed, 27 insertions(+), 9 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} (91%)

diff --git a/gcc/testsuite/c-c++-common/gomp/map-1.c b/gcc/testsuite/c-c++-common/gomp/map-1.c
index 5dad7d6a9aa..cd026f1243f 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 5dad7d6a9aa..107b59ee87a 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 'map' 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,6 +17,7 @@ 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])
@@ -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" } */
@@ -107,3 +109,9 @@ foo (int g[3][10], int h[4][8], int i[2][10], int j[][9],
   #pragma omp target map(r[3:][2:1][1:2][:][:3]) /* { dg-error "array section is not contiguous" } */
     ;
 }
+
+static void
+instantiate ()
+{
+  &foo<0>;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/map-2.c b/gcc/testsuite/g++.dg/gomp/map-2.C
similarity index 91%
copy from gcc/testsuite/c-c++-common/gomp/map-2.c
copy to gcc/testsuite/g++.dg/gomp/map-2.C
index 101f4047b85..10eaaa948b8 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 'map' 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])
 {
@@ -42,3 +44,9 @@ foo (int *p, int (*q)[10], int r[10], int s[10][10])
   #pragma omp target map (tofrom: b[2:5][0:-4]) /* { dg-error "negative length in array section in" } */
   ;
 }
+
+static void
+instantiate ()
+{
+  &foo<0>;
+}
-- 
2.17.1

>From e7e0360147d973e7634f16bfec265cd4cc937e1c Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <tho...@codesourcery.com>
Date: Wed, 25 Nov 2020 11:41:45 +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.
	* c-c++-common/gomp/map-1.c: Adjust.
	* c-c++-common/gomp/map-2.c: Likewise.

(cherry picked from commit 1049e5408fa343b5bf0a6380212a8ec8dfe2b6fc)
---
 gcc/testsuite/c-c++-common/gomp/map-1.c            |  5 +++--
 gcc/testsuite/c-c++-common/gomp/map-2.c            |  5 +++--
 .../gomp/map-1.c => g++.dg/gomp/map-1.C}           | 14 +++++++++++---
 .../gomp/map-2.c => g++.dg/gomp/map-2.C}           | 12 ++++++++++--
 4 files changed, 27 insertions(+), 9 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} (91%)

diff --git a/gcc/testsuite/c-c++-common/gomp/map-1.c b/gcc/testsuite/c-c++-common/gomp/map-1.c
index 5dad7d6a9aa..cd026f1243f 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 5dad7d6a9aa..107b59ee87a 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 'map' 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,6 +17,7 @@ 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])
@@ -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" } */
@@ -107,3 +109,9 @@ foo (int g[3][10], int h[4][8], int i[2][10], int j[][9],
   #pragma omp target map(r[3:][2:1][1:2][:][:3]) /* { dg-error "array section is not contiguous" } */
     ;
 }
+
+static void
+instantiate ()
+{
+  &foo<0>;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/map-2.c b/gcc/testsuite/g++.dg/gomp/map-2.C
similarity index 91%
copy from gcc/testsuite/c-c++-common/gomp/map-2.c
copy to gcc/testsuite/g++.dg/gomp/map-2.C
index 101f4047b85..10eaaa948b8 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 'map' 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])
 {
@@ -42,3 +44,9 @@ foo (int *p, int (*q)[10], int r[10], int s[10][10])
   #pragma omp target map (tofrom: b[2:5][0:-4]) /* { dg-error "negative length in array section in" } */
   ;
 }
+
+static void
+instantiate ()
+{
+  &foo<0>;
+}
-- 
2.17.1

Reply via email to