summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/goacc-gomp/nesting-fail-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/c-c++-common/goacc-gomp/nesting-fail-1.c')
-rw-r--r--gcc/testsuite/c-c++-common/goacc-gomp/nesting-fail-1.c457
1 files changed, 457 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/goacc-gomp/nesting-fail-1.c b/gcc/testsuite/c-c++-common/goacc-gomp/nesting-fail-1.c
new file mode 100644
index 00000000000..411fb5f8755
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc-gomp/nesting-fail-1.c
@@ -0,0 +1,457 @@
+extern int i;
+
+void
+f_omp (void)
+{
+#pragma omp parallel
+ {
+#pragma acc parallel /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+#pragma acc kernels /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+#pragma acc data /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+#pragma acc update host(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+#pragma acc enter data copyin(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+#pragma acc exit data delete(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ }
+
+#pragma omp for
+ for (i = 0; i < 3; i++)
+ {
+#pragma acc parallel /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+#pragma acc kernels /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+#pragma acc data /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+#pragma acc update host(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+#pragma acc enter data copyin(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+#pragma acc exit data delete(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+#pragma acc loop /* { dg-error "may not be closely nested" } */
+ for (i = 0; i < 2; ++i)
+ ;
+ }
+
+#pragma omp sections
+ {
+ {
+#pragma acc parallel /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+ }
+#pragma omp section
+ {
+#pragma acc kernels /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+ }
+#pragma omp section
+ {
+#pragma acc data /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+ }
+#pragma omp section
+ {
+#pragma acc update host(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ }
+#pragma omp section
+ {
+#pragma acc enter data copyin(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ }
+#pragma omp section
+ {
+#pragma acc exit data delete(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ }
+#pragma omp section
+ {
+#pragma acc loop /* { dg-error "may not be closely nested" } */
+ for (i = 0; i < 2; ++i)
+ ;
+ }
+ }
+
+#pragma omp single
+ {
+#pragma acc parallel /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+#pragma acc kernels /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+#pragma acc data /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+#pragma acc update host(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+#pragma acc enter data copyin(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+#pragma acc exit data delete(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+#pragma acc loop /* { dg-error "may not be closely nested" } */
+ for (i = 0; i < 2; ++i)
+ ;
+ }
+
+#pragma omp task
+ {
+#pragma acc parallel /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+#pragma acc kernels /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+#pragma acc data /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+#pragma acc update host(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+#pragma acc enter data copyin(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+#pragma acc exit data delete(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+#pragma acc loop /* { dg-error "may not be closely nested" } */
+ for (i = 0; i < 2; ++i)
+ ;
+ }
+
+#pragma omp master
+ {
+#pragma acc parallel /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+#pragma acc kernels /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+#pragma acc data /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+#pragma acc update host(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+#pragma acc enter data copyin(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+#pragma acc exit data delete(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+#pragma acc loop /* { dg-error "may not be closely nested" } */
+ for (i = 0; i < 2; ++i)
+ ;
+ }
+
+#pragma omp critical
+ {
+#pragma acc parallel /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+#pragma acc kernels /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+#pragma acc data /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+#pragma acc update host(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+#pragma acc enter data copyin(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+#pragma acc exit data delete(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+#pragma acc loop /* { dg-error "may not be closely nested" } */
+ for (i = 0; i < 2; ++i)
+ ;
+ }
+
+#pragma omp ordered
+ {
+#pragma acc parallel /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+#pragma acc kernels /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+#pragma acc data /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+ ;
+#pragma acc update host(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+#pragma acc enter data copyin(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+#pragma acc exit data delete(i) /* { dg-error "OpenACC construct inside of non-OpenACC region" } */
+#pragma acc loop /* { dg-error "may not be closely nested" } */
+ for (i = 0; i < 2; ++i)
+ ;
+ }
+
+#pragma omp target
+ {
+#pragma acc parallel /* { dg-error "OpenACC parallel construct inside of OpenMP target region" } */
+ ;
+#pragma acc kernels /* { dg-error "OpenACC kernels construct inside of OpenMP target region" } */
+ ;
+#pragma acc data /* { dg-error "OpenACC data construct inside of OpenMP target region" } */
+ ;
+#pragma acc update host(i) /* { dg-error "OpenACC update construct inside of OpenMP target region" } */
+#pragma acc enter data copyin(i) /* { dg-error "OpenACC enter/exit data construct inside of OpenMP target region" } */
+#pragma acc exit data delete(i) /* { dg-error "OpenACC enter/exit data construct inside of OpenMP target region" } */
+#pragma acc loop
+ for (i = 0; i < 2; ++i)
+ ;
+ }
+}
+
+void
+f_acc_parallel (void)
+{
+#pragma acc parallel
+ {
+#pragma omp parallel /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc parallel
+ {
+#pragma omp for /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ for (i = 0; i < 3; i++)
+ ;
+ }
+
+#pragma acc parallel
+ {
+#pragma omp sections /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ {
+ ;
+ }
+ }
+
+#pragma acc parallel
+ {
+#pragma omp single /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc parallel
+ {
+#pragma omp task /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc parallel
+ {
+#pragma omp master /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc parallel
+ {
+#pragma omp critical /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc parallel
+ {
+#pragma omp atomic write
+ i = 0; /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ }
+
+#pragma acc parallel
+ {
+#pragma omp ordered /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc parallel
+ {
+#pragma omp target /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+#pragma omp target data /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+#pragma omp target update to(i) /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ }
+}
+
+void
+f_acc_kernels (void)
+{
+#pragma acc kernels
+ {
+#pragma omp parallel /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc kernels
+ {
+#pragma omp for /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ for (i = 0; i < 3; i++)
+ ;
+ }
+
+#pragma acc kernels
+ {
+#pragma omp sections /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ {
+ ;
+ }
+ }
+
+#pragma acc kernels
+ {
+#pragma omp single /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc kernels
+ {
+#pragma omp task /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc kernels
+ {
+#pragma omp master /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc kernels
+ {
+#pragma omp critical /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc kernels
+ {
+#pragma omp atomic write
+ i = 0; /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ }
+
+#pragma acc kernels
+ {
+#pragma omp ordered /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc kernels
+ {
+#pragma omp target /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+#pragma omp target data /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+#pragma omp target update to(i) /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ }
+}
+
+void
+f_acc_data (void)
+{
+#pragma acc data
+ {
+#pragma omp parallel /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc data
+ {
+#pragma omp for /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ for (i = 0; i < 3; i++)
+ ;
+ }
+
+#pragma acc data
+ {
+#pragma omp sections /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ {
+ ;
+ }
+ }
+
+#pragma acc data
+ {
+#pragma omp single /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc data
+ {
+#pragma omp task /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc data
+ {
+#pragma omp master /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc data
+ {
+#pragma omp critical /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc data
+ {
+#pragma omp atomic write
+ i = 0; /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ }
+
+#pragma acc data
+ {
+#pragma omp ordered /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc data
+ {
+#pragma omp target /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+#pragma omp target data /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+#pragma omp target update to(i) /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ }
+}
+
+void
+f_acc_loop (void)
+{
+#pragma acc loop
+ for (i = 0; i < 2; ++i)
+ {
+#pragma omp parallel /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc loop
+ for (i = 0; i < 2; ++i)
+ {
+#pragma omp for /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ for (i = 0; i < 3; i++)
+ ;
+ }
+
+#pragma acc loop
+ for (i = 0; i < 2; ++i)
+ {
+#pragma omp sections /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ {
+ ;
+ }
+ }
+
+#pragma acc loop
+ for (i = 0; i < 2; ++i)
+ {
+#pragma omp single /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc loop
+ for (i = 0; i < 2; ++i)
+ {
+#pragma omp task /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc loop
+ for (i = 0; i < 2; ++i)
+ {
+#pragma omp master /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc loop
+ for (i = 0; i < 2; ++i)
+ {
+#pragma omp critical /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc loop
+ for (i = 0; i < 2; ++i)
+ {
+#pragma omp atomic write
+ i = 0; /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ }
+
+#pragma acc loop
+ for (i = 0; i < 2; ++i)
+ {
+#pragma omp ordered /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+ }
+
+#pragma acc loop
+ for (i = 0; i < 2; ++i)
+ {
+#pragma omp target /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+#pragma omp target data /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ ;
+#pragma omp target update to(i) /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
+ }
+}