This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

OpenMP target update tests


Hi!

Does that look appropriate (for trunk)?

 gcc/c/c-parser.c                                  |  2 +-
 gcc/c/c-typeck.c                                  |  2 ++
 gcc/cp/parser.c                                   |  2 +-
 gcc/cp/semantics.c                                |  2 ++
 gcc/testsuite/c-c++-common/gomp/target-update-1.c | 41 +++++++++++++++++++++++
 5 files changed, 47 insertions(+), 2 deletions(-)

diff --git gcc/c/c-parser.c gcc/c/c-parser.c
index ae13b0a..d9c91f0 100644
--- gcc/c/c-parser.c
+++ gcc/c/c-parser.c
@@ -13530,7 +13530,7 @@ c_parser_omp_target_update (location_t loc, c_parser *parser,
       && find_omp_clause (clauses, OMP_CLAUSE_FROM) == NULL_TREE)
     {
       error_at (loc,
-		"%<#pragma omp target update must contain at least one "
+		"%<#pragma omp target update%> must contain at least one "
 		"%<from%> or %<to%> clauses");
       return false;
     }
diff --git gcc/c/c-typeck.c gcc/c/c-typeck.c
index b6db627..ab78f6d 100644
--- gcc/c/c-typeck.c
+++ gcc/c/c-typeck.c
@@ -12152,6 +12152,8 @@ c_finish_omp_clauses (tree clauses)
 		      remove = true;
 		    }
 		}
+	      /* Currently, we're not doing any further checking for array
+		 sections.  */
 	      break;
 	    }
 	  if (t == error_mark_node)
diff --git gcc/cp/parser.c gcc/cp/parser.c
index e52edbb..6c88fe4 100644
--- gcc/cp/parser.c
+++ gcc/cp/parser.c
@@ -30288,7 +30288,7 @@ cp_parser_omp_target_update (cp_parser *parser, cp_token *pragma_tok,
       && find_omp_clause (clauses, OMP_CLAUSE_FROM) == NULL_TREE)
     {
       error_at (pragma_tok->location,
-		"%<#pragma omp target update must contain at least one "
+		"%<#pragma omp target update%> must contain at least one "
 		"%<from%> or %<to%> clauses");
       return false;
     }
diff --git gcc/cp/semantics.c gcc/cp/semantics.c
index 7f06f3f..5f29268 100644
--- gcc/cp/semantics.c
+++ gcc/cp/semantics.c
@@ -5648,6 +5648,8 @@ finish_omp_clauses (tree clauses)
 		      remove = true;
 		    }
 		}
+	      /* Currently, we're not doing any further checking for array
+		 sections.  */
 	      break;
 	    }
 	  if (t == error_mark_node)
diff --git gcc/testsuite/c-c++-common/gomp/target-update-1.c gcc/testsuite/c-c++-common/gomp/target-update-1.c
new file mode 100644
index 0000000..8476314
--- /dev/null
+++ gcc/testsuite/c-c++-common/gomp/target-update-1.c
@@ -0,0 +1,41 @@
+void
+f (int a[10], float b)
+{
+#pragma omp target update from(a)
+#pragma omp target update to(a)
+#pragma omp target update from(b)
+#pragma omp target update to(b)
+
+#pragma omp target update from(a, b)
+#pragma omp target update from(a) to(b)
+#pragma omp target update to(a, b)
+
+#pragma omp target update from(a, a, b) /* { dg-error "'a' appears more than once in motion clauses" } */
+#pragma omp target update to(a, a) to(b) /* { dg-error "'a' appears more than once in motion clauses" } */
+#pragma omp target update from(a) from(a, b) /* { dg-error "'a' appears more than once in motion clauses" } */
+#pragma omp target update from(a) to(a) from(b) /* { dg-error "'a' appears more than once in motion clauses" } */
+#pragma omp target update to(a) to(a) from(b) /* { dg-error "'a' appears more than once in motion clauses" } */
+
+#pragma omp target update from(a, b, b) /* { dg-error "'b' appears more than once in motion clauses" } */
+#pragma omp target update to(a) to(b, b) /* { dg-error "'b' appears more than once in motion clauses" } */
+#pragma omp target update from(a, b) from(b) /* { dg-error "'b' appears more than once in motion clauses" } */
+#pragma omp target update from(a) to(b) from(b) /* { dg-error "'b' appears more than once in motion clauses" } */
+#pragma omp target update from(a) to(b) to(b) /* { dg-error "'b' appears more than once in motion clauses" } */
+
+#pragma omp target update to(a) from(a[1:1]) /* { dg-error "'a' appears more than once in motion clauses" "not implemented" { xfail *-*-* } } */
+#pragma omp target update to(a[1:1]) from(a[1:1]) /* { dg-error "'a' appears more than once in motion clauses" "not implemented" { xfail *-*-* } } */
+#pragma omp target update to(a[1:1]) to(a[1:1]) /* { dg-error "'a' appears more than once in motion clauses" "not implemented" { xfail *-*-* } } */
+#pragma omp target update to(a[1:3]) from(a[2:1]) /* { dg-error "'a' appears more than once in motion clauses" "not implemented" { xfail *-*-* } } */
+
+#pragma omp target update from(a) if(0)
+
+#pragma omp target update from(a) if(0) if(0) /* { dg-error "too many 'if' clauses" } */
+
+#pragma omp target update from(a) device(0)
+
+#pragma omp target update from(a) device(0) device(0) /* { dg-error "too many 'device' clauses" } */
+
+#pragma omp target update if(0) /* { dg-error "'#pragma omp target update' must contain at least one 'from' or 'to' clauses" } */
+#pragma omp target update device(0) /* { dg-error "'#pragma omp target update' must contain at least one 'from' or 'to' clauses" } */
+#pragma omp target update if(0) device(0) /* { dg-error "'#pragma omp target update' must contain at least one 'from' or 'to' clauses" } */
+}


GrÃÃe,
 Thomas

Attachment: pgpzDA3uHrdfb.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]