+2017-05-19 Thomas Schwinge <thomas@codesourcery.com>
+
+ * parser.c (cp_parser_omp_clause_default): Avoid printing more
+ than one syntax error message.
+
2017-05-19 Nathan Sidwell <nathan@acm.org>
* class.c (class_dump_id): Define.
cp_parser_error (parser, "expected %<none%> or %<shared%>");
}
- if (!cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN))
+ if (kind == OMP_CLAUSE_DEFAULT_UNSPECIFIED
+ || !cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN))
cp_parser_skip_to_closing_parenthesis (parser, /*recovering=*/true,
/*or_comma=*/false,
/*consume_paren=*/true);
+2017-05-19 Thomas Schwinge <thomas@codesourcery.com>
+
+ * c-c++-common/goacc/default-1.c: New file.
+ * c-c++-common/goacc/default-2.c: Likewise.
+ * c-c++-common/goacc/data-default-1.c: Remove file, including its
+ test cases in...
+ * c-c++-common/goacc/default-3.c: ... this new file, and...
+ * c-c++-common/goacc/default-4.c: ... this new file.
+ * gfortran.dg/goacc/default.f95: Remove file, including its test
+ cases in...
+ * gfortran.dg/goacc/default-1.f95: ... this new file, and...
+ * gfortran.dg/goacc/default-2.f: ... this new file.
+ * gfortran.dg/goacc/default-3.f95: New file.
+ * gfortran.dg/goacc/default-4.f: Likewise.
+
2017-05-19 Nathan Sidwell <nathan@acm.org>
* g++.dg/inherit/covariant7.C: Adjust.
+++ /dev/null
-/* { dg-do compile } */
-
-
-int main ()
-{
- int n = 2;
- int ary[2];
-
-#pragma acc parallel default (none) /* { dg-message "'parallel' construct" "2" } */
- {
- ary[0] /* { dg-error "not specified in enclosing" } */
- = n; /* { dg-error "not specified in enclosing" } */
- }
-
-#pragma acc kernels default (none) /* { dg-message "'kernels' construct" "2" } */
- {
- ary[0] /* { dg-error "not specified in enclosing" } */
- = n; /* { dg-error "not specified in enclosing" } */
- }
-
-#pragma acc data copy (ary, n)
- {
-#pragma acc parallel default (none)
- {
- ary[0]
- = n;
- }
-
-#pragma acc kernels default (none)
- {
- ary[0]
- = n;
- }
- }
-
- return 0;
-}
--- /dev/null
+/* OpenACC default clause: valid syntax. */
+
+void f1 ()
+{
+#pragma acc kernels default (none)
+ ;
+#pragma acc parallel default (none)
+ ;
+}
--- /dev/null
+/* OpenACC default clause: invalid syntax. */
+
+void f1 ()
+{
+#pragma acc kernels default /* { dg-error "expected .\\(. before end of line" } */
+ ;
+#pragma acc parallel default /* { dg-error "expected .\\(. before end of line" } */
+ ;
+
+#pragma acc kernels default ( /* { dg-error "expected .none. before end of line" } */
+ ;
+#pragma acc parallel default ( /* { dg-error "expected .none. before end of line" } */
+ ;
+
+#pragma acc kernels default (, /* { dg-error "expected .none. before .,. token" } */
+ ;
+#pragma acc parallel default (, /* { dg-error "expected .none. before .,. token" } */
+ ;
+
+#pragma acc kernels default () /* { dg-error "expected .none. before .\\). token" } */
+ ;
+#pragma acc parallel default () /* { dg-error "expected .none. before .\\). token" } */
+ ;
+
+#pragma acc kernels default (,) /* { dg-error "expected .none. before .,. token" } */
+ ;
+#pragma acc parallel default (,) /* { dg-error "expected .none. before .,. token" } */
+ ;
+
+#pragma acc kernels default (firstprivate) /* { dg-error "expected .none. before .firstprivate." } */
+ ;
+#pragma acc parallel default (firstprivate) /* { dg-error "expected .none. before .firstprivate." } */
+ ;
+
+#pragma acc kernels default (private) /* { dg-error "expected .none. before .private." } */
+ ;
+#pragma acc parallel default (private) /* { dg-error "expected .none. before .private." } */
+ ;
+
+#pragma acc kernels default (shared) /* { dg-error "expected .none. before .shared." } */
+ ;
+#pragma acc parallel default (shared) /* { dg-error "expected .none. before .shared." } */
+ ;
+
+#pragma acc kernels default (none /* { dg-error "expected .\\). before end of line" } */
+ ;
+#pragma acc parallel default (none /* { dg-error "expected .\\). before end of line" } */
+ ;
+
+#pragma acc kernels default (none none) /* { dg-error "expected .\\). before .none." } */
+ ;
+#pragma acc parallel default (none none) /* { dg-error "expected .\\). before .none." } */
+ ;
+
+#pragma acc kernels default (none, none) /* { dg-error "expected .\\). before .,. token" } */
+ ;
+#pragma acc parallel default (none, none) /* { dg-error "expected .\\). before .,. token" } */
+ ;
+}
--- /dev/null
+/* OpenACC default (none) clause. */
+
+void f1 ()
+{
+ int f1_a = 2;
+ float f1_b[2];
+
+#pragma acc kernels default (none) /* { dg-message "enclosing OpenACC .kernels. construct" } */
+ {
+ f1_b[0] /* { dg-error ".f1_b. not specified in enclosing OpenACC .kernels. construct" } */
+ = f1_a; /* { dg-error ".f1_a. not specified in enclosing OpenACC .kernels. construct" } */
+ }
+#pragma acc parallel default (none) /* { dg-message "enclosing OpenACC .parallel. construct" } */
+ {
+ f1_b[0] /* { dg-error ".f1_b. not specified in enclosing OpenACC .parallel. construct" } */
+ = f1_a; /* { dg-error ".f1_a. not specified in enclosing OpenACC .parallel. construct" } */
+ }
+}
--- /dev/null
+/* OpenACC default clause inside data construct. */
+
+/* { dg-additional-options "-fdump-tree-gimple" } */
+
+void f1 ()
+{
+ int f1_a = 2;
+ float f1_b[2];
+
+#pragma acc data copyin (f1_a) copyout (f1_b)
+ /* { dg-final { scan-tree-dump-times "omp target oacc_data map\\(force_from:f1_b \[^\\)\]+\\) map\\(force_to:f1_a" 1 "gimple" } } */
+ {
+#pragma acc kernels
+ /* { dg-final { scan-tree-dump-times "omp target oacc_kernels map\\(tofrom:f1_b \[^\\)\]+\\) map\\(tofrom:f1_a" 1 "gimple" } } */
+ {
+ f1_b[0] = f1_a;
+ }
+#pragma acc parallel
+ /* { dg-final { scan-tree-dump-times "omp target oacc_parallel map\\(tofrom:f1_b \[^\\)\]+\\) map\\(tofrom:f1_a" 1 "gimple" } } */
+ {
+ f1_b[0] = f1_a;
+ }
+ }
+}
+
+void f2 ()
+{
+ int f2_a = 2;
+ float f2_b[2];
+
+#pragma acc data copyin (f2_a) copyout (f2_b)
+ /* { dg-final { scan-tree-dump-times "omp target oacc_data map\\(force_from:f2_b \[^\\)\]+\\) map\\(force_to:f2_a" 1 "gimple" } } */
+ {
+#pragma acc kernels default (none)
+ /* { dg-final { scan-tree-dump-times "omp target oacc_kernels default\\(none\\) map\\(tofrom:f2_b \[^\\)\]+\\) map\\(tofrom:f2_a" 1 "gimple" } } */
+ {
+ f2_b[0] = f2_a;
+ }
+#pragma acc parallel default (none)
+ /* { dg-final { scan-tree-dump-times "omp target oacc_parallel default\\(none\\) map\\(tofrom:f2_b \[^\\)\]+\\) map\\(tofrom:f2_a" 1 "gimple" } } */
+ {
+ f2_b[0] = f2_a;
+ }
+ }
+}
--- /dev/null
+! OpenACC default clause: valid syntax.
+
+subroutine f1
+ implicit none
+
+ !$acc kernels default (none)
+ !$acc end kernels
+ !$acc parallel default (none)
+ !$acc end parallel
+end subroutine f1
--- /dev/null
+! OpenACC default clause: invalid syntax.
+
+ SUBROUTINE F1
+ IMPLICIT NONE
+
+!$ACC KERNELS DEFAULT ! { dg-error "Unclassifiable OpenACC directive" }
+!$ACC END KERNELS ! { dg-error "Unexpected" }
+!$ACC PARALLEL DEFAULT ! { dg-error "Unclassifiable OpenACC directive" }
+!$ACC END PARALLEL ! { dg-error "Unexpected" }
+
+!$ACC KERNELS DEFAULT ( ! { dg-error "Unclassifiable OpenACC directive" }
+!$ACC END KERNELS ! { dg-error "Unexpected" }
+!$ACC PARALLEL DEFAULT ( ! { dg-error "Unclassifiable OpenACC directive" }
+!$ACC END PARALLEL ! { dg-error "Unexpected" }
+
+!$ACC KERNELS DEFAULT (, ! { dg-error "Unclassifiable OpenACC directive" }
+!$ACC END KERNELS ! { dg-error "Unexpected" }
+!$ACC PARALLEL DEFAULT (, ! { dg-error "Unclassifiable OpenACC directive" }
+!$ACC END PARALLEL ! { dg-error "Unexpected" }
+
+!$ACC KERNELS DEFAULT () ! { dg-error "Unclassifiable OpenACC directive" }
+!$ACC END KERNELS ! { dg-error "Unexpected" }
+!$ACC PARALLEL DEFAULT () ! { dg-error "Unclassifiable OpenACC directive" }
+!$ACC END PARALLEL ! { dg-error "Unexpected" }
+
+!$ACC KERNELS DEFAULT (,) ! { dg-error "Unclassifiable OpenACC directive" }
+!$ACC END KERNELS ! { dg-error "Unexpected" }
+!$ACC PARALLEL DEFAULT (,) ! { dg-error "Unclassifiable OpenACC directive" }
+!$ACC END PARALLEL ! { dg-error "Unexpected" }
+
+!$ACC KERNELS DEFAULT (FIRSTPRIVATE) ! { dg-error "Unclassifiable OpenACC directive" }
+!$ACC END KERNELS ! { dg-error "Unexpected" }
+!$ACC PARALLEL DEFAULT (FIRSTPRIVATE) ! { dg-error "Unclassifiable OpenACC directive" }
+!$ACC END PARALLEL ! { dg-error "Unexpected" }
+
+!$ACC KERNELS DEFAULT (PRIVATE) ! { dg-error "Unclassifiable OpenACC directive" }
+!$ACC END KERNELS ! { dg-error "Unexpected" }
+!$ACC PARALLEL DEFAULT (PRIVATE) ! { dg-error "Unclassifiable OpenACC directive" }
+!$ACC END PARALLEL ! { dg-error "Unexpected" }
+
+!$ACC KERNELS DEFAULT (SHARED) ! { dg-error "Unclassifiable OpenACC directive" }
+!$ACC END KERNELS ! { dg-error "Unexpected" }
+!$ACC PARALLEL DEFAULT (SHARED) ! { dg-error "Unclassifiable OpenACC directive" }
+!$ACC END PARALLEL ! { dg-error "Unexpected" }
+
+!$ACC KERNELS DEFAULT (NONE ! { dg-error "Unclassifiable OpenACC directive" }
+!$ACC END KERNELS ! { dg-error "Unexpected" }
+!$ACC PARALLEL DEFAULT (NONE ! { dg-error "Unclassifiable OpenACC directive" }
+!$ACC END PARALLEL ! { dg-error "Unexpected" }
+
+!$ACC KERNELS DEFAULT (NONE NONE) ! { dg-error "Unclassifiable OpenACC directive" }
+!$ACC END KERNELS ! { dg-error "Unexpected" }
+!$ACC PARALLEL DEFAULT (NONE NONE) ! { dg-error "Unclassifiable OpenACC directive" }
+!$ACC END PARALLEL ! { dg-error "Unexpected" }
+
+!$ACC KERNELS DEFAULT (NONE, NONE) ! { dg-error "Unclassifiable OpenACC directive" }
+!$ACC END KERNELS ! { dg-error "Unexpected" }
+!$ACC PARALLEL DEFAULT (NONE, NONE) ! { dg-error "Unclassifiable OpenACC directive" }
+!$ACC END PARALLEL ! { dg-error "Unexpected" }
+ END SUBROUTINE F1
--- /dev/null
+! OpenACC default (none) clause.
+
+subroutine f1
+ implicit none
+ integer :: f1_a = 2
+ real, dimension (2) :: f1_b
+
+ !$acc kernels default (none) ! { dg-message "enclosing OpenACC .kernels. construct" }
+ f1_b(1) & ! { dg-error ".f1_b. not specified in enclosing OpenACC .kernels. construct" "" { xfail *-*-* } }
+ = f1_a; ! { dg-error ".f1_a. not specified in enclosing OpenACC .kernels. construct" }
+ ! { dg-bogus ".f1_b. not specified in enclosing OpenACC .kernels. construct" "" { xfail *-*-* } .-1 }
+ !$acc end kernels
+ !$acc parallel default (none) ! { dg-message "enclosing OpenACC .parallel. construct" }
+ f1_b(1) & ! { dg-error ".f1_b. not specified in enclosing OpenACC .parallel. construct" "" { xfail *-*-* } }
+ = f1_a; ! { dg-error ".f1_a. not specified in enclosing OpenACC .parallel. construct" }
+ ! { dg-bogus ".f1_b. not specified in enclosing OpenACC .parallel. construct" "" { xfail *-*-* } .-1 }
+ !$acc end parallel
+end subroutine f1
--- /dev/null
+! OpenACC default clause inside data construct.
+
+! { dg-additional-options "-fdump-tree-gimple" }
+
+ SUBROUTINE F1
+ IMPLICIT NONE
+ INTEGER :: F1_A = 2
+ REAL, DIMENSION (2) :: F1_B
+
+!$ACC DATA COPYIN (F1_A) COPYOUT (F1_B)
+! { dg-final { scan-tree-dump-times "omp target oacc_data map\\(force_to:f1_a \[^\\)\]+\\) map\\(force_from:f1_b" 1 "gimple" } }
+!$ACC KERNELS
+! { dg-final { scan-tree-dump-times "omp target oacc_kernels map\\(tofrom:f1_b \[^\\)\]+\\) map\\(tofrom:f1_a" 1 "gimple" } }
+ F1_B(1) = F1_A;
+!$ACC END KERNELS
+!$ACC PARALLEL
+! { dg-final { scan-tree-dump-times "omp target oacc_parallel map\\(tofrom:f1_b \[^\\)\]+\\) map\\(tofrom:f1_a" 1 "gimple" } }
+ F1_B(1) = F1_A;
+!$ACC END PARALLEL
+!$ACC END DATA
+ END SUBROUTINE F1
+
+ SUBROUTINE F2
+ IMPLICIT NONE
+ INTEGER :: F2_A = 2
+ REAL, DIMENSION (2) :: F2_B
+
+!$ACC DATA COPYIN (F2_A) COPYOUT (F2_B)
+! { dg-final { scan-tree-dump-times "omp target oacc_data map\\(force_to:f2_a \[^\\)\]+\\) map\\(force_from:f2_b" 1 "gimple" } }
+!$ACC KERNELS DEFAULT (NONE)
+! { dg-final { scan-tree-dump-times "omp target oacc_kernels default\\(none\\) map\\(tofrom:f2_b \[^\\)\]+\\) map\\(tofrom:f2_a" 1 "gimple" } }
+ F2_B(1) = F2_A;
+!$ACC END KERNELS
+!$ACC PARALLEL DEFAULT (NONE)
+! { dg-final { scan-tree-dump-times "omp target oacc_parallel default\\(none\\) map\\(tofrom:f2_b \[^\\)\]+\\) map\\(tofrom:f2_a" 1 "gimple" } }
+ F2_B(1) = F2_A;
+!$ACC END PARALLEL
+!$ACC END DATA
+ END SUBROUTINE F2
+++ /dev/null
-! { dg-do compile }
-
-program tile
- integer i, j, a
-
- !$acc parallel default (shared) ! { dg-error "Unclassifiable OpenACC directive" }
- !$acc end parallel ! { dg-error "Unexpected" }
-
- !$acc parallel default (private) ! { dg-error "Unclassifiable OpenACC directive" }
- !$acc end parallel ! { dg-error "Unexpected" }
-
- !$acc parallel default (none)
- !$acc end parallel
-
- !$acc parallel default (firstprivate) ! { dg-error "Unclassifiable OpenACC directive" }
- !$acc end parallel ! { dg-error "Unexpected" }
-end program tile