Hi Jakub!

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.
>> I suppose these are real, and should get resolved at some point?
>
> I guess it depends.  Do you get a diagnostics if you instantiate the
> templates?  If yes, it is not a bug, [...]

Good point, thanks!  Instantiating changes things as follows:

    --- gcc/testsuite/g++.dg/gomp/map-1.C
    +++ gcc/testsuite/g++.dg/gomp/map-1.C
    @@ -25 +25 @@ foo (int g[3][10], int h[4][8], int i[2][10], int j[][9],
    -  #pragma omp target map(to: bar[2:5]) /* { dg-error "is not a variable" 
"TODO" { xfail *-*-* } } */
    +  #pragma omp target map(to: bar[2:5]) /* { dg-error "is not a variable" } 
*/
    @@ -111,0 +112,6 @@ foo (int g[3][10], int h[4][8], int i[2][10], int 
j[][9],
    +
    +static void
    +instantiate ()
    +{
    +  &foo<0>;
    +}

..., that is, the first XFAIL disappears (now matches the C/C++ variant),
but the second remains, see updated patch 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 4b0b66e95aa1b26768e2770e383cc4f7a26b2128 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.
---
 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..89ed727141b 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,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..7709fb49b67 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])
 {
@@ -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