+2015-10-21 Nathan Sidwell <nathan@codesourcery.com>
+
+ * omp-low.c (check_omp_nesting_restrictions): Check OpenACC loop
+ nesting.
+
2015-10-21 Ilya Enkovich <enkovich.gnu@gmail.com>
* doc/tm.texi: Regenerated.
/* We split taskloop into task and nested taskloop in it. */
if (gimple_omp_for_kind (stmt) == GF_OMP_FOR_KIND_TASKLOOP)
return true;
+ if (gimple_omp_for_kind (stmt) == GF_OMP_FOR_KIND_OACC_LOOP)
+ {
+ bool ok = false;
+
+ if (ctx)
+ switch (gimple_code (ctx->stmt))
+ {
+ case GIMPLE_OMP_FOR:
+ ok = (gimple_omp_for_kind (ctx->stmt)
+ == GF_OMP_FOR_KIND_OACC_LOOP);
+ break;
+
+ case GIMPLE_OMP_TARGET:
+ switch (gimple_omp_target_kind (ctx->stmt))
+ {
+ case GF_OMP_TARGET_KIND_OACC_PARALLEL:
+ case GF_OMP_TARGET_KIND_OACC_KERNELS:
+ ok = true;
+ break;
+
+ default:
+ break;
+ }
+
+ default:
+ break;
+ }
+ else if (get_oacc_fn_attrib (current_function_decl))
+ ok = true;
+ if (!ok)
+ {
+ error_at (gimple_location (stmt),
+ "OpenACC loop directive must be associated with"
+ " an OpenACC compute region");
+ return false;
+ }
+ }
/* FALLTHRU */
case GIMPLE_CALL:
if (is_gimple_call (stmt)
+2015-10-21 Nathan Sidwell <nathan@codesourcery.com>
+
+ * c-c++-common/goacc/clauses-fail.c: Adjust errors.
+ * c-c++-common/goacc/sb-1.c: Adjust errors.
+ * c-c++-common/goacc/sb-3.c: Adjust errors.
+ * c-c++-common/goacc/loop-1.c: Adjust errors.
+ * c-c++-common/goacc/nesting-1.c: Adjust errors.
+ * c-c++-common/goacc-gomp/nesting-fail-1.c: Adjust errors.
+ * c-c++-common/goacc-gomp/nesting-1.c: Adjust errors.
+
2015-10-21 Ilya Enkovich <enkovich.gnu@gmail.com>
* g++.dg/ext/vector22.C: Allow VEC_COND_EXPR.
{
int i;
-#pragma acc loop
+#pragma acc loop /* { dg-error "loop directive must be associated with an OpenACC compute region" } */
for (i = 0; i < 2; ++i)
;
}
#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" } */
+#pragma acc loop /* { dg-error "loop directive must be associated with an OpenACC compute region" } */
for (i = 0; i < 2; ++i)
;
}
}
#pragma omp section
{
-#pragma acc loop /* { dg-error "may not be closely nested" } */
+#pragma acc loop /* { dg-error "loop directive must be associated with an OpenACC compute region" } */
for (i = 0; i < 2; ++i)
;
}
#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" } */
+#pragma acc loop /* { dg-error "loop directive must be associated with an OpenACC compute region" } */
for (i = 0; i < 2; ++i)
;
}
#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" } */
+#pragma acc loop /* { dg-error "loop directive must be associated with an OpenACC compute region" } */
for (i = 0; i < 2; ++i)
;
}
#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" } */
+#pragma acc loop /* { dg-error "loop directive must be associated with an OpenACC compute region" } */
for (i = 0; i < 2; ++i)
;
}
#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" } */
+#pragma acc loop /* { dg-error "loop directive must be associated with an OpenACC compute region" } */
for (i = 0; i < 2; ++i)
;
}
#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" } */
+#pragma acc loop /* { dg-error "loop directive must be associated with an OpenACC compute region" } */
for (i = 0; i < 2; ++i)
;
}
#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
+#pragma acc loop /* { dg-error "loop directive must be associated with an OpenACC compute region" } */
for (i = 0; i < 2; ++i)
;
}
void
f_acc_loop (void)
{
+#pragma acc parallel
#pragma acc loop
for (i = 0; i < 2; ++i)
{
;
}
+#pragma acc parallel
#pragma acc loop
for (i = 0; i < 2; ++i)
{
;
}
+#pragma acc parallel
#pragma acc loop
for (i = 0; i < 2; ++i)
{
}
}
+#pragma acc parallel
#pragma acc loop
for (i = 0; i < 2; ++i)
{
;
}
+#pragma acc parallel
#pragma acc loop
for (i = 0; i < 2; ++i)
{
;
}
+#pragma acc parallel
#pragma acc loop
for (i = 0; i < 2; ++i)
{
;
}
+#pragma acc parallel
#pragma acc loop
for (i = 0; i < 2; ++i)
{
;
}
+#pragma acc parallel
#pragma acc loop
for (i = 0; i < 2; ++i)
{
i = 0; /* { dg-error "non-OpenACC construct inside of OpenACC region" } */
}
+#pragma acc parallel
#pragma acc loop
for (i = 0; i < 2; ++i)
{
;
}
+#pragma acc parallel
#pragma acc loop
for (i = 0; i < 2; ++i)
{
#pragma acc data two /* { dg-error "expected '#pragma acc' clause before 'two'" } */
;
+#pragma acc parallel
#pragma acc loop deux /* { dg-error "expected '#pragma acc' clause before 'deux'" } */
for (i = 0; i < 2; ++i)
;
i = d;
a[i] = 1;
}
- #pragma acc loop
+ #pragma acc loop /* { dg-error "loop directive must be associated with an OpenACC compute region" } */
for (i = 1; i < 30; i++ )
if (i == 16) break; /* { dg-error "break statement used" } */
/* different types of for loop are allowed */
- #pragma acc loop
+ #pragma acc loop /* { dg-error "loop directive must be associated with an OpenACC compute region" } */
for (i = 1; i < 10; i++)
{
}
- #pragma acc loop
+ #pragma acc loop /* { dg-error "loop directive must be associated with an OpenACC compute region" } */
for (i = 1; i < 10; i+=2)
{
a[i] = i;
#pragma acc exit data delete(i)
-#pragma acc loop
+#pragma acc loop /* { dg-error "loop directive must be associated with an OpenACC compute region" } */
for (i = 0; i < 2; ++i)
;
#pragma acc exit data delete(i)
-#pragma acc loop
+#pragma acc loop /* { dg-error "loop directive must be associated with an OpenACC compute region" } */
for (i = 0; i < 2; ++i)
;
}
goto bad1; // { dg-error "invalid branch to/from OpenACC structured block" }
#pragma acc data
goto bad1; // { dg-error "invalid branch to/from OpenACC structured block" }
- #pragma acc loop
+ #pragma acc loop /* { dg-error "loop directive must be associated with an OpenACC compute region" } */
for (l = 0; l < 2; ++l)
goto bad1; // { dg-error "invalid branch to/from OpenACC structured block" }
}
goto bad2_loop; // { dg-error "invalid entry to OpenACC structured block" }
- #pragma acc loop
+ #pragma acc loop /* { dg-error "loop directive must be associated with an OpenACC compute region" } */
for (l = 0; l < 2; ++l)
{
bad2_loop: ;
{ ok1_data: break; }
}
- #pragma acc loop
+ #pragma acc loop /* { dg-error "loop directive must be associated with an OpenACC compute region" } */
for (l = 0; l < 2; ++l)
{
int i;
void f (void)
{
int i, j;
-#pragma acc loop
+#pragma acc loop /* { dg-error "loop directive must be associated with an OpenACC compute region" } */
for(i = 1; i < 30; i++)
{
if (i == 7) goto out; // { dg-error "invalid branch to/from OpenACC structured block" }
-#pragma acc loop // { dg-error "work-sharing region may not be closely nested inside of work-sharing, critical, ordered, master or explicit task region" }
+#pragma acc loop
for(j = 5; j < 10; j++)
{
if (i == 6 && j == 7) goto out; // { dg-error "invalid branch to/from OpenACC structured block" }