Skip to content

Commit 5d6ed6d

Browse files
committed
c-c++-common/gomp/{attrs-,}metadirective-3.c: Fix expected result [PR118694]
With compilation for nvptx enabled, two issues showed up: (a) "error: 'target' construct with nested 'teams' construct contains directives outside of the 'teams' construct" See PR comment 9 why this is difficult to fix. Solution: Add dg-bogus and accept/expect the error for 'target offload_nvptx'. (b) The assumptions about the dump for 'target offload_nvptx' were wrong as the metadirective was already expanded to a OMP_NEXT_VARIANT construct such that no 'omp metadirective' was left in either case. Solution: Check that no 'omp metadirective' is left; additionally, expect either OMP_NEXT_VARIANT (when offload_nvptx is available) or no 'teams' directive at all (if not). gcc/testsuite/ChangeLog: PR middle-end/118694 * c-c++-common/gomp/attrs-metadirective-3.c: Change to never expect 'omp metadirective' in the dump. If !offload_nvptx, check that no 'teams' shows up in the dump; for offload_nvptx, expect OMP_NEXT_VARIANT and an error about directive between 'target' and 'teams'. * c-c++-common/gomp/metadirective-3.c: Likewise.
1 parent 97e8cd9 commit 5d6ed6d

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

gcc/testsuite/c-c++-common/gomp/attrs-metadirective-3.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ f (int x[], int y[], int z[])
99
{
1010
int i;
1111

12-
[[omp::sequence (directive (target map(to: x, y) map(from: z)),
12+
[[omp::sequence (directive (target map(to: x, y) map(from: z)), /* { dg-bogus "'target' construct with nested 'teams' construct contains directives outside of the 'teams' construct" "PR118694" { xfail offload_nvptx } } */
1313
directive (metadirective
1414
when (device={arch("nvptx")}: teams loop)
1515
default (parallel loop)))]]
@@ -20,5 +20,6 @@ f (int x[], int y[], int z[])
2020
/* If offload device "nvptx" isn't supported, the front end can eliminate
2121
that alternative and not produce a metadirective at all. Otherwise this
2222
won't be resolved until late. */
23-
/* { dg-final { scan-tree-dump-not "#pragma omp metadirective" "gimple" { target { ! offload_nvptx } } } } */
24-
/* { dg-final { scan-tree-dump "#pragma omp metadirective" "gimple" { target { offload_nvptx } } } } */
23+
/* { dg-final { scan-tree-dump-not "#pragma omp metadirective" "gimple" } } */
24+
/* { dg-final { scan-tree-dump-not " teams" "gimple" { target { ! offload_nvptx } } } } */
25+
/* { dg-final { scan-tree-dump "variant.\[0-9\]+ = \\\[omp_next_variant\\\] OMP_NEXT_VARIANT <0,\[\r\n \]+construct context = 14\[\r\n \]+1: device = \\{arch \\(.nvptx.\\)\\}\[\r\n \]+2: >;" "gimple" { target { offload_nvptx } } } } */

gcc/testsuite/c-c++-common/gomp/metadirective-3.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ f (int x[], int y[], int z[])
88
{
99
int i;
1010

11-
#pragma omp target map(to: x, y) map(from: z)
11+
#pragma omp target map(to: x, y) map(from: z) /* { dg-bogus "'target' construct with nested 'teams' construct contains directives outside of the 'teams' construct" "PR118694" { xfail offload_nvptx } } */
1212
#pragma omp metadirective \
1313
when (device={arch("nvptx")}: teams loop) \
1414
default (parallel loop)
@@ -19,5 +19,6 @@ f (int x[], int y[], int z[])
1919
/* If offload device "nvptx" isn't supported, the front end can eliminate
2020
that alternative and not produce a metadirective at all. Otherwise this
2121
won't be resolved until late. */
22-
/* { dg-final { scan-tree-dump-not "#pragma omp metadirective" "gimple" { target { ! offload_nvptx } } } } */
23-
/* { dg-final { scan-tree-dump "#pragma omp metadirective" "gimple" { target { offload_nvptx } } } } */
22+
/* { dg-final { scan-tree-dump-not "#pragma omp metadirective" "gimple" } } */
23+
/* { dg-final { scan-tree-dump-not " teams" "gimple" { target { ! offload_nvptx } } } } */
24+
/* { dg-final { scan-tree-dump "variant.\[0-9\]+ = \\\[omp_next_variant\\\] OMP_NEXT_VARIANT <0,\[\r\n \]+construct context = 14\[\r\n \]+1: device = \\{arch \\(.nvptx.\\)\\}\[\r\n \]+2: >;" "gimple" { target { offload_nvptx } } } } */

0 commit comments

Comments
 (0)