Message ID | 87d00192na.fsf@dem-tschwing-1.ger.mentorg.com |
---|---|
State | New |
Headers | show |
Series | Add 'g++.dg/gomp/map-{1,2}.C' | expand |
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, the implementation is allowed but not required to diagnose bugs in uninstantiated templates (the C++ wording is if a template is invalid for all possible instantiations, then the program is ill-formed, no diagnostic required or so). It can be a QoI, but not everything can be diagnosed on uninstantiated templates. I'd suggest in any case to instantiate the templates unless you want to check solely for the QoI diagnostics on uninstantiated templates. Jakub
Hi Jakub! On 2020-11-25T11:10:18+0100, Jakub Jelinek <jakub@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
On Wed, Nov 25, 2020 at 11:43:48AM +0100, Thomas Schwinge wrote: > On 2020-11-25T11:10:18+0100, Jakub Jelinek <jakub@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. Ok, patch ok for trunk. If you could file a PR for the TODO xfail, I'd appreciate it. Thanks. Jakub
Hi! On 2020-11-25T11:52:44+0100, Jakub Jelinek <jakub@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 <jakub@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 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