+2016-06-10 Thomas Schwinge <thomas@codesourcery.com>
+
+ * omp-low.c (scan_sharing_clauses): Don't expect
+ OMP_CLAUSE__CACHE_.
+
2016-06-10 Alan Hayward <alan.hayward@arm.com>
PR tree-optimization/71407
+2016-06-10 Thomas Schwinge <thomas@codesourcery.com>
+
+ PR c/71381
+ * c-parser.c (c_parser_omp_variable_list) <OMP_CLAUSE__CACHE_>:
+ Loosen checking.
+
2016-06-08 Martin Sebor <msebor@redhat.com>
Jakub Jelinek <jakub@redhat.com>
switch (kind)
{
case OMP_CLAUSE__CACHE_:
+ /* The OpenACC cache directive explicitly only allows "array
+ elements or subarrays". */
if (c_parser_peek_token (parser)->type != CPP_OPEN_SQUARE)
{
c_parser_error (parser, "expected %<[%>");
break;
}
- if (kind == OMP_CLAUSE__CACHE_)
- {
- if (TREE_CODE (low_bound) != INTEGER_CST
- && !TREE_READONLY (low_bound))
- {
- error_at (clause_loc,
- "%qD is not a constant", low_bound);
- t = error_mark_node;
- }
-
- if (TREE_CODE (length) != INTEGER_CST
- && !TREE_READONLY (length))
- {
- error_at (clause_loc,
- "%qD is not a constant", length);
- t = error_mark_node;
- }
- }
-
t = tree_cons (low_bound, length, t);
}
break;
+2016-06-10 Thomas Schwinge <thomas@codesourcery.com>
+
+ PR c/71381
+ * parser.c (cp_parser_omp_var_list_no_open) <OMP_CLAUSE__CACHE_>:
+ Loosen checking.
+
2016-06-09 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/71465
switch (kind)
{
case OMP_CLAUSE__CACHE_:
+ /* The OpenACC cache directive explicitly only allows "array
+ elements or subarrays". */
if (cp_lexer_peek_token (parser->lexer)->type != CPP_OPEN_SQUARE)
{
error_at (token->location, "expected %<[%>");
RT_CLOSE_SQUARE))
goto skip_comma;
- if (kind == OMP_CLAUSE__CACHE_)
- {
- if (TREE_CODE (low_bound) != INTEGER_CST
- && !TREE_READONLY (low_bound))
- {
- error_at (token->location,
- "%qD is not a constant", low_bound);
- decl = error_mark_node;
- }
-
- if (TREE_CODE (length) != INTEGER_CST
- && !TREE_READONLY (length))
- {
- error_at (token->location,
- "%qD is not a constant", length);
- decl = error_mark_node;
- }
- }
-
decl = tree_cons (low_bound, length, decl);
}
break;
+2016-06-10 Thomas Schwinge <thomas@codesourcery.com>
+
+ PR c/71381
+ * openmp.c (gfc_match_oacc_cache): Add comment.
+
2016-06-05 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/71404
gfc_match_oacc_cache (void)
{
gfc_omp_clauses *c = gfc_get_omp_clauses ();
+ /* The OpenACC cache directive explicitly only allows "array elements or
+ subarrays", which we're currently not checking here. Either check this
+ after the call of gfc_match_omp_variable_list, or add something like a
+ only_sections variant next to its allow_sections parameter. */
match m = gfc_match_omp_variable_list (" (",
&c->lists[OMP_LIST_CACHE], true,
NULL, NULL, true);
break;
case OMP_CLAUSE__CACHE_:
- sorry ("Clause not supported yet");
- break;
-
default:
gcc_unreachable ();
}
break;
case OMP_CLAUSE__CACHE_:
- sorry ("Clause not supported yet");
- break;
-
default:
gcc_unreachable ();
}
+2016-06-10 Thomas Schwinge <thomas@codesourcery.com>
+
+ PR c/71381
+ * c-c++-common/goacc/cache-1.c: Update. Move invalid usage tests
+ to...
+ * c-c++-common/goacc/cache-2.c: ... this new file.
+ * gfortran.dg/goacc/cache-1.f95: Move invalid usage tests to...
+ * gfortran.dg/goacc/cache-2.f95: ... this new file.
+ * gfortran.dg/goacc/coarray.f95: Update OpenACC cache directive
+ usage.
+ * gfortran.dg/goacc/cray.f95: Likewise.
+ * gfortran.dg/goacc/loop-1.f95: Likewise.
+
2016-06-10 Alan Hayward <alan.hayward@arm.com>
PR tree-optimization/71407
+/* OpenACC cache directive: valid usage. */
+/* For execution testing, this file is "#include"d from
+ libgomp/testsuite/libgomp.oacc-c-c++-common/cache-1.c. */
+
int
main (int argc, char **argv)
{
int n = 1;
const int len = n;
-#pragma acc cache /* { dg-error "expected '\\\(' before end of line" } */
-
-#pragma acc cache a[0:N] /* { dg-error "expected '\\\(' before 'a'" } */
- /* { dg-bogus "expected end of line before 'a'" "" { xfail c++ } 26 } */
-
-#pragma acc cache (a) /* { dg-error "expected '\\\['" } */
-
-#pragma acc cache ( /* { dg-error "expected (identifier|unqualified-id) before end of line" } */
-
-#pragma acc cache () /* { dg-error "expected (identifier|unqualified-id) before '\\\)' token" } */
-
-#pragma acc cache (,) /* { dg-error "expected (identifier|unqualified-id) before '(,|\\\))' token" } */
-
-#pragma acc cache (a[0:N] /* { dg-error "expected '\\\)' before end of line" } */
-
-#pragma acc cache (a[0:N],) /* { dg-error "expected (identifier|unqualified-id) before '(,|\\\))' token" "" { xfail c } } */
-
-#pragma acc cache (a[0:N]) copyin (a[0:N]) /* { dg-error "expected end of line before 'copyin'" } */
-
-#pragma acc cache () /* { dg-error "expected (identifier|unqualified-id) before '\\\)' token" } */
-
-#pragma acc cache (a[0:N] b[0:N]) /* { dg-error "expected '\\\)' before 'b'" } */
-
-#pragma acc cache (a[0:N] b[0:N}) /* { dg-error "expected '\\\)' before 'b'" } */
- /* { dg-bogus "expected end of line before '\\\}' token" "" { xfail c++ } 47 } */
-
-#pragma acc cache (a[0:N] /* { dg-error "expected '\\\)' before end of line" } */
-
-#pragma acc cache (a[ii]) /* { dg-error "'ii' is not a constant" } */
-
-#pragma acc cache (a[idx:n]) /* { dg-error "'n' is not a constant" } */
-
-#pragma acc cache (a[0:N]) ( /* { dg-error "expected end of line before '\\(' token" } */
-
-#pragma acc cache (a[0:N]) ii /* { dg-error "expected end of line before 'ii'" } */
-
-#pragma acc cache (a[0:N] ii) /* { dg-error "expected '\\)' before 'ii'" } */
-
+ /* Have at it, GCC! */
#pragma acc cache (a[0:N])
-
#pragma acc cache (a[0:N], a[0:N])
-
#pragma acc cache (a[0:N], b[0:N])
-
#pragma acc cache (a[0])
-
#pragma acc cache (a[0], a[1], b[0:N])
-
+#pragma acc cache (a[i - 5])
+#pragma acc cache (a[i + 5:len])
+#pragma acc cache (a[i + 5:len - 1])
+#pragma acc cache (b[i])
+#pragma acc cache (b[i:len])
+#pragma acc cache (a[ii])
+#pragma acc cache (a[ii:len])
+#pragma acc cache (b[ii - 1])
+#pragma acc cache (b[ii - 1:len])
+#pragma acc cache (b[i - ii + 1])
+#pragma acc cache (b[i + ii - 1:len])
+#pragma acc cache (b[i * ii - 1:len + 1])
+#pragma acc cache (a[idx + 2])
+#pragma acc cache (a[idx:len + 2])
#pragma acc cache (a[idx])
-
#pragma acc cache (a[idx:len])
+#pragma acc cache (a[idx + 2:len])
+#pragma acc cache (a[idx + 2 + i:len])
+#pragma acc cache (a[idx + 2 + i + ii:len])
b[ii] = a[ii];
}
--- /dev/null
+/* OpenACC cache directive: invalid usage. */
+
+int
+main (int argc, char **argv)
+{
+#define N 2
+ int a[N], b[N];
+ int i;
+
+ for (i = 0; i < N; i++)
+ {
+ a[i] = 3;
+ b[i] = 0;
+ }
+
+#pragma acc parallel copyin (a[0:N]) copyout (b[0:N])
+{
+ int ii;
+
+ for (ii = 0; ii < N; ii++)
+ {
+ const int idx = ii;
+ int n = 1;
+ const int len = n;
+
+#pragma acc cache /* { dg-error "expected '\\\(' before end of line" } */
+#pragma acc cache a[0:N] /* { dg-error "expected '\\\(' before 'a'" } */
+ /* { dg-bogus "expected end of line before 'a'" "" { xfail c++ } 27 } */
+#pragma acc cache (a) /* { dg-error "expected '\\\['" } */
+#pragma acc cache ( /* { dg-error "expected (identifier|unqualified-id) before end of line" } */
+#pragma acc cache () /* { dg-error "expected (identifier|unqualified-id) before '\\\)' token" } */
+#pragma acc cache (,) /* { dg-error "expected (identifier|unqualified-id) before '(,|\\\))' token" } */
+#pragma acc cache (a[0:N] /* { dg-error "expected '\\\)' before end of line" } */
+#pragma acc cache (a[0:N],) /* { dg-error "expected (identifier|unqualified-id) before '(,|\\\))' token" "" { xfail c } } */
+#pragma acc cache (a[0:N]) copyin (a[0:N]) /* { dg-error "expected end of line before 'copyin'" } */
+#pragma acc cache () /* { dg-error "expected (identifier|unqualified-id) before '\\\)' token" } */
+#pragma acc cache (a[0:N] b[0:N]) /* { dg-error "expected '\\\)' before 'b'" } */
+#pragma acc cache (a[0:N] b[0:N}) /* { dg-error "expected '\\\)' before 'b'" } */
+ /* { dg-bogus "expected end of line before '\\\}' token" "" { xfail c++ } 38 } */
+#pragma acc cache (a[0:N] /* { dg-error "expected '\\\)' before end of line" } */
+#pragma acc cache (a[0:N]) ( /* { dg-error "expected end of line before '\\(' token" } */
+#pragma acc cache (a[0:N]) ii /* { dg-error "expected end of line before 'ii'" } */
+#pragma acc cache (a[0:N] ii) /* { dg-error "expected '\\)' before 'ii'" } */
+
+ b[ii] = a[ii];
+ }
+}
+
+
+ for (i = 0; i < N; i++)
+ {
+ if (a[i] != b[i])
+ __builtin_abort ();
+ }
+
+ return 0;
+}
-! { dg-do compile }
+! OpenACC cache directive: valid usage.
+! For execution testing, this file is "#include"d from
+! libgomp/testsuite/libgomp.oacc-fortran/cache-1.f95.
! { dg-additional-options "-std=f2008" }
program test
integer :: i, d(10), e(5,13)
do concurrent (i=1:5)
- !$acc cache (d)
!$acc cache (d(1:3))
!$acc cache (d(i:i+2))
-
- !$acc cache (e)
!$acc cache (e(1:3,2:4))
!$acc cache (e(i:i+2,i+1:i+3))
enddo
--- /dev/null
+! OpenACC cache directive: invalid usage.
+! { dg-additional-options "-std=f2008" }
+
+program test
+ implicit none
+ integer :: i, d(10), e(5,13)
+
+ do concurrent (i=1:5)
+ !$acc cache (d) ! { dg-error "" "TODO" { xfail *-*-* } }
+ !$acc cache (e) ! { dg-error "" "TODO" { xfail *-*-* } }
+ enddo
+end
!$acc end parallel loop
!$acc parallel loop
do i = 1,5
- !$acc cache (a)
+ !$acc cache (a) ! { dg-error "" "TODO" { xfail *-*-* } }
enddo
!$acc end parallel loop
!$acc update device (a)
!$acc end parallel loop
!$acc parallel loop
do i = 1,5
- !$acc cache (ptr) ! TODO: This must fail, as in openacc-1_0-branch
+ !TODO: This must fail, as in openacc-1_0-branch.
+ !$acc cache (ptr) ! { dg-error "" "TODO" { xfail *-*-* } }
enddo
!$acc end parallel loop
!$acc update device (ptr)
enddo
- !$acc cache (a) ! { dg-error "inside of loop" }
+ !$acc cache (a(1:10)) ! { dg-error "ACC CACHE directive must be inside of loop" }
do i = 1,10
- !$acc cache(a)
+ !$acc cache(a(i:i+1))
enddo
do i = 1,10
+ !$acc cache(a(i:i+1))
a(i) = i
- !$acc cache(a)
+ !$acc cache(a(i+2:i+2+1))
enddo
end subroutine test1
+2016-06-10 Thomas Schwinge <thomas@codesourcery.com>
+
+ PR c/71381
+ * testsuite/libgomp.oacc-c-c++-common/cache-1.c: #include
+ "../../../gcc/testsuite/c-c++-common/goacc/cache-1.c".
+ * testsuite/libgomp.oacc-fortran/cache-1.f95: New file.
+
2016-06-03 Chung-Lin Tang <cltang@codesourcery.com>
* testsuite/libgomp.oacc-fortran/reduction-8.f90: New testcase.
-int
-main (int argc, char **argv)
-{
-#define N 2
- int a[N], b[N];
- int i;
+/* OpenACC cache directive. */
- for (i = 0; i < N; i++)
- {
- a[i] = 3;
- b[i] = 0;
- }
-
-#pragma acc parallel copyin (a[0:N]) copyout (b[0:N])
-{
- int ii;
-
- for (ii = 0; ii < N; ii++)
- {
- const int idx = ii;
- int n = 1;
- const int len = n;
-
-#pragma acc cache (a[0:N])
-
-#pragma acc cache (a[0:N], b[0:N])
-
-#pragma acc cache (a[0])
-
-#pragma acc cache (a[0], a[1], b[0:N])
-
-#pragma acc cache (a[idx])
-
-#pragma acc cache (a[idx:len])
-
- b[ii] = a[ii];
- }
-}
-
-
- for (i = 0; i < N; i++)
- {
- if (a[i] != b[i])
- __builtin_abort ();
- }
-
- return 0;
-}
+#include "../../../gcc/testsuite/c-c++-common/goacc/cache-1.c"
--- /dev/null
+! OpenACC cache directive.
+! { dg-do run }
+! { dg-additional-options "-std=f2008" }
+! { dg-additional-options "-cpp" }
+
+#include "../../../gcc/testsuite/gfortran.dg/goacc/cache-1.f95"