Handle oacc region in oacc routine
2015-10-16 Tom de Vries <tom@codesourcery.com>
* omp-low.c (check_omp_nesting_restrictions): Check for oacc region in
oacc routine.
* c-c++-common/goacc/nesting-fail-1.c (f_acc_routine): Add oacc region
in oacc routine test.
---
gcc/omp-low.c | 8 ++++++++
gcc/testsuite/c-c++-common/goacc/nesting-fail-1.c | 8 ++++++++
2 files changed, 16 insertions(+)
@@ -3715,6 +3715,14 @@ check_omp_nesting_restrictions (gimple *stmt, omp_context *ctx)
kind == OMP_CLAUSE_DEPEND_SOURCE ? "source" : "sink");
return false;
}
+ if (is_gimple_omp_offloaded (stmt)
+ && get_oacc_fn_attrib (cfun->decl) != NULL)
+ {
+ error_at (gimple_location (stmt),
+ "OpenACC region inside of OpenACC routine, nested "
+ "parallelism not supported yet");
+ return false;
+ }
for (; ctx != NULL; ctx = ctx->outer)
{
if (gimple_code (ctx->stmt) != GIMPLE_OMP_TARGET)
@@ -37,3 +37,11 @@ f_acc_kernels (void)
#pragma acc exit data delete(i) /* { dg-error ".enter/exit data. construct inside of .kernels. region" } */
}
}
+
+#pragma acc routine
+void
+f_acc_routine (void)
+{
+#pragma acc parallel /* { dg-error "OpenACC region inside of OpenACC routine, nested parallelism not supported yet" } */
+ ;
+}