diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2019-06-19 00:13:54 +0200 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gcc.gnu.org> | 2019-06-19 00:13:54 +0200 |
commit | 3a37d6f68c50d38303cf04039f79fc65e72d5a27 (patch) | |
tree | 6ad78acf990e5a9e6427ec88b9d7d916e7409d9d /libgomp | |
parent | ab2c347c358036f017003ab7c1043705c6482a8c (diff) | |
download | gcc-3a37d6f68c50d38303cf04039f79fc65e72d5a27.zip gcc-3a37d6f68c50d38303cf04039f79fc65e72d5a27.tar.gz gcc-3a37d6f68c50d38303cf04039f79fc65e72d5a27.tar.bz2 |
[PR90862] OpenACC 'declare' ICE when nested inside another construct
gcc/
PR middle-end/90862
* omp-low.c (check_omp_nesting_restrictions): Handle
GF_OMP_TARGET_KIND_OACC_DECLARE.
gcc/testsuite/
PR middle-end/90862
* c-c++-common/goacc/declare-1.c: Update.
* c-c++-common/goacc/declare-2.c: Likewise.
libgomp/
PR middle-end/90862
* testsuite/libgomp.oacc-c-c++-common/declare-1.c: Update.
From-SVN: r272444
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/ChangeLog | 5 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.oacc-c-c++-common/declare-1.c | 98 |
2 files changed, 97 insertions, 6 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 827bab2..06004aa 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,8 @@ +2019-06-18 Thomas Schwinge <thomas@codesourcery.com> + + PR middle-end/90862 + * testsuite/libgomp.oacc-c-c++-common/declare-1.c: Update. + 2019-06-16 Tom de Vries <tdevries@suse.de> PR tree-optimization/89376 diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/declare-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/declare-1.c index bc7261742..087b954 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/declare-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/declare-1.c @@ -1,6 +1,5 @@ #include <openacc.h> #include <stdlib.h> -#include <stdio.h> #define N 8 @@ -39,14 +38,14 @@ subr1 (int *a) } } -int b[8]; +int b[N]; #pragma acc declare create (b) -int d[8] = { 1, 2, 3, 4, 5, 6, 7, 8 }; +int d[N] = { 1, 2, 3, 4, 5, 6, 7, 8 }; #pragma acc declare copyin (d) -int -main (int argc, char **argv) +static void +f (void) { int a[N]; int e[N]; @@ -110,11 +109,98 @@ main (int argc, char **argv) subr2 (&a[0]); - for (i = 0; i < 1; i++) + for (i = 0; i < N; i++) { if (a[i] != 1234 * 6) abort (); } +} + + +/* The same as 'f' but everything contained in an OpenACC 'data' construct. */ + +static void +f_data (void) +{ +#pragma acc data + { + int a[N]; + int e[N]; +# pragma acc declare create (e) + int i; + + for (i = 0; i < N; i++) + a[i] = i + 1; + + if (!acc_is_present (&b, sizeof (b))) + abort (); + + if (!acc_is_present (&d, sizeof (d))) + abort (); + + if (!acc_is_present (&e, sizeof (e))) + abort (); + +# pragma acc parallel copyin (a[0:N]) + { + for (i = 0; i < N; i++) + { + b[i] = a[i]; + a[i] = b[i]; + } + } + + for (i = 0; i < N; i++) + { + if (a[i] != i + 1) + abort (); + } + +# pragma acc parallel copy (a[0:N]) + { + for (i = 0; i < N; i++) + { + e[i] = a[i] + d[i]; + a[i] = e[i]; + } + } + + for (i = 0; i < N; i++) + { + if (a[i] != (i + 1) * 2) + abort (); + } + + for (i = 0; i < N; i++) + { + a[i] = 1234; + } + + subr1 (&a[0]); + + for (i = 0; i < N; i++) + { + if (a[i] != 1234 * 2) + abort (); + } + + subr2 (&a[0]); + + for (i = 0; i < N; i++) + { + if (a[i] != 1234 * 6) + abort (); + } + } +} + + +int +main (int argc, char **argv) +{ + f (); + + f_data (); return 0; } |