public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-3543] openmp: Allow optional comma after directive-specifier in C/C++
@ 2022-10-28  9:08 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2022-10-28  9:08 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:89999f2358724fa4e71c7c3b4de340582c0e43da

commit r13-3543-g89999f2358724fa4e71c7c3b4de340582c0e43da
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Oct 28 11:03:56 2022 +0200

    openmp: Allow optional comma after directive-specifier in C/C++
    
    Previously we've been allowing that comma only in C++ when in attribute
    form (which was the reason why it has been allowed), but 5.1 allows that
    even in pragma form in C/C++ (with clarifications in 5.2) and 5.2
    also in Fortran (which this patch doesn't implement).
    
    Note, for directives which take an argument (== unnamed clause),
    comma is not allowed in between the directive name and the argument,
    like the directive-1.c testcase shows.
    
    2022-10-28  Jakub Jelinek  <jakub@redhat.com>
    
    gcc/c/
            * c-parser.cc (c_parser_omp_all_clauses): Allow optional
            comma before the first clause.
            (c_parser_omp_allocate, c_parser_omp_atomic, c_parser_omp_depobj,
            c_parser_omp_flush, c_parser_omp_scan_loop_body,
            c_parser_omp_ordered, c_finish_omp_declare_variant,
            c_parser_omp_declare_target, c_parser_omp_declare_reduction,
            c_parser_omp_requires, c_parser_omp_error,
            c_parser_omp_assumption_clauses): Likewise.
    gcc/cp/
            * parser.cc (cp_parser_omp_all_clauses): Allow optional comma
            before the first clause even in pragma syntax.
            (cp_parser_omp_allocate, cp_parser_omp_atomic, cp_parser_omp_depobj,
            cp_parser_omp_flush, cp_parser_omp_scan_loop_body,
            cp_parser_omp_ordered, cp_parser_omp_assumption_clauses,
            cp_finish_omp_declare_variant, cp_parser_omp_declare_target,
            cp_parser_omp_declare_reduction_exprs, cp_parser_omp_requires,
            cp_parser_omp_error): Likewise.
    gcc/testsuite/
            * c-c++-common/gomp/directive-1.c: New test.
            * c-c++-common/gomp/clauses-6.c: New test.
            * c-c++-common/gomp/declare-variant-2.c (f75a): Declare.
            (f75): Use f75a as variant instead of f1 and don't expect error.
            * g++.dg/gomp/clause-4.C (foo): Don't expect error on comma
            before first clause.
            * gcc.dg/gomp/clause-2.c (foo): Likewise.

Diff:
---
 gcc/c/c-parser.cc                                  |  64 ++-
 gcc/cp/parser.cc                                   |  73 +--
 gcc/testsuite/c-c++-common/gomp/clauses-6.c        | 604 +++++++++++++++++++++
 .../c-c++-common/gomp/declare-variant-2.c          |   3 +-
 gcc/testsuite/c-c++-common/gomp/directive-1.c      |  28 +
 gcc/testsuite/g++.dg/gomp/clause-4.C               |   2 +-
 gcc/testsuite/gcc.dg/gomp/clause-2.c               |   2 +-
 7 files changed, 687 insertions(+), 89 deletions(-)

diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
index 5bdcd93b5c7..4d1dcb1b159 100644
--- a/gcc/c/c-parser.cc
+++ b/gcc/c/c-parser.cc
@@ -17460,7 +17460,7 @@ c_parser_omp_all_clauses (c_parser *parser, omp_clause_mask mask,
       if (nested && c_parser_next_token_is (parser, CPP_CLOSE_PAREN))
 	break;
 
-      if (!first)
+      if (!first || nested != 2)
 	{
 	  if (c_parser_next_token_is (parser, CPP_COMMA))
 	    c_parser_consume_token (parser);
@@ -18547,6 +18547,9 @@ c_parser_omp_allocate (location_t loc, c_parser *parser)
 {
   tree allocator = NULL_TREE;
   tree nl = c_parser_omp_var_list_parens (parser, OMP_CLAUSE_ALLOCATE, NULL_TREE);
+  if (c_parser_next_token_is (parser, CPP_COMMA)
+      && c_parser_peek_2nd_token (parser)->type == CPP_NAME)
+    c_parser_consume_token (parser);
   if (c_parser_next_token_is (parser, CPP_NAME))
     {
       matching_parens parens;
@@ -18685,7 +18688,6 @@ c_parser_omp_atomic (location_t loc, c_parser *parser, bool openacc)
   bool structured_block = false;
   bool swapped = false;
   bool non_lvalue_p;
-  bool first = true;
   tree clauses = NULL_TREE;
   bool capture = false;
   bool compare = false;
@@ -18696,13 +18698,10 @@ c_parser_omp_atomic (location_t loc, c_parser *parser, bool openacc)
 
   while (c_parser_next_token_is_not (parser, CPP_PRAGMA_EOL))
     {
-      if (!first
-	  && c_parser_next_token_is (parser, CPP_COMMA)
+      if (c_parser_next_token_is (parser, CPP_COMMA)
 	  && c_parser_peek_2nd_token (parser)->type == CPP_NAME)
 	c_parser_consume_token (parser);
 
-      first = false;
-
       if (c_parser_next_token_is (parser, CPP_NAME))
 	{
 	  const char *p
@@ -19646,6 +19645,8 @@ c_parser_omp_depobj (c_parser *parser)
   parens.skip_until_found_close (parser);
   tree clause = NULL_TREE;
   enum omp_clause_depend_kind kind = OMP_CLAUSE_DEPEND_INVALID;
+  if (c_parser_next_token_is (parser, CPP_COMMA))
+    c_parser_consume_token (parser);
   location_t c_loc = c_parser_peek_token (parser)->location;
   if (c_parser_next_token_is (parser, CPP_NAME))
     {
@@ -19722,6 +19723,9 @@ c_parser_omp_flush (c_parser *parser)
   location_t loc = c_parser_peek_token (parser)->location;
   c_parser_consume_pragma (parser);
   enum memmodel mo = MEMMODEL_LAST;
+  if (c_parser_next_token_is (parser, CPP_COMMA)
+      && c_parser_peek_2nd_token (parser)->type == CPP_NAME)
+    c_parser_consume_token (parser);
   if (c_parser_next_token_is (parser, CPP_NAME))
     {
       const char *p
@@ -19814,6 +19818,9 @@ c_parser_omp_scan_loop_body (c_parser *parser, bool open_brace_parsed)
 
       c_parser_consume_pragma (parser);
 
+      if (c_parser_next_token_is (parser, CPP_COMMA))
+	c_parser_consume_token (parser);
+
       if (c_parser_next_token_is (parser, CPP_NAME))
 	{
 	  const char *p
@@ -20597,9 +20604,14 @@ c_parser_omp_ordered (c_parser *parser, enum pragma_context context,
       return false;
     }
 
-  if (c_parser_next_token_is (parser, CPP_NAME))
+  int n = 1;
+  if (c_parser_next_token_is (parser, CPP_COMMA))
+    n = 2;
+
+  if (c_parser_peek_nth_token (parser, n)->type == CPP_NAME)
     {
-      const char *p = IDENTIFIER_POINTER (c_parser_peek_token (parser)->value);
+      const char *p
+	= IDENTIFIER_POINTER (c_parser_peek_nth_token (parser, n)->value);
 
       if (!strcmp ("depend", p) || !strcmp ("doacross", p))
 	{
@@ -22472,6 +22484,10 @@ c_finish_omp_declare_variant (c_parser *parser, tree fndecl, tree parms)
 
   parens.require_close (parser);
 
+  if (c_parser_next_token_is (parser, CPP_COMMA)
+      && c_parser_peek_2nd_token (parser)->type == CPP_NAME)
+    c_parser_consume_token (parser);
+
   const char *clause = "";
   location_t match_loc = c_parser_peek_token (parser)->location;
   if (c_parser_next_token_is (parser, CPP_NAME))
@@ -22641,7 +22657,9 @@ c_parser_omp_declare_target (c_parser *parser)
   tree clauses = NULL_TREE;
   int device_type = 0;
   bool only_device_type = true;
-  if (c_parser_next_token_is (parser, CPP_NAME))
+  if (c_parser_next_token_is (parser, CPP_NAME)
+      || (c_parser_next_token_is (parser, CPP_COMMA)
+	  && c_parser_peek_2nd_token (parser)->type == CPP_NAME))
     clauses = c_parser_omp_all_clauses (parser, OMP_DECLARE_TARGET_CLAUSE_MASK,
 					"#pragma omp declare target");
   else if (c_parser_next_token_is (parser, CPP_OPEN_PAREN))
@@ -23062,10 +23080,14 @@ c_parser_omp_declare_reduction (c_parser *parser, enum pragma_context context)
       initializer.set_error ();
       if (!c_parser_require (parser, CPP_CLOSE_PAREN, "expected %<)%>"))
 	bad = true;
-      else if (c_parser_next_token_is (parser, CPP_NAME)
-	       && strcmp (IDENTIFIER_POINTER
+      else if (c_parser_next_token_is (parser, CPP_COMMA)
+	       && c_parser_peek_2nd_token (parser)->type == CPP_NAME)
+	c_parser_consume_token (parser);
+      if (!bad
+	  && (c_parser_next_token_is (parser, CPP_NAME)
+	      && strcmp (IDENTIFIER_POINTER
 				(c_parser_peek_token (parser)->value),
-			  "initializer") == 0)
+			  "initializer") == 0))
 	{
 	  c_parser_consume_token (parser);
 	  pop_scope ();
@@ -23258,7 +23280,6 @@ c_parser_omp_declare (c_parser *parser, enum pragma_context context)
 static void
 c_parser_omp_requires (c_parser *parser)
 {
-  bool first = true;
   enum omp_requires new_req = (enum omp_requires) 0;
 
   c_parser_consume_pragma (parser);
@@ -23266,13 +23287,10 @@ c_parser_omp_requires (c_parser *parser)
   location_t loc = c_parser_peek_token (parser)->location;
   while (c_parser_next_token_is_not (parser, CPP_PRAGMA_EOL))
     {
-      if (!first
-	  && c_parser_next_token_is (parser, CPP_COMMA)
+      if (c_parser_next_token_is (parser, CPP_COMMA)
 	  && c_parser_peek_2nd_token (parser)->type == CPP_NAME)
 	c_parser_consume_token (parser);
 
-      first = false;
-
       if (c_parser_next_token_is (parser, CPP_NAME))
 	{
 	  const char *p
@@ -23543,7 +23561,6 @@ c_parser_omp_error (c_parser *parser, enum pragma_context context)
   int at_compilation = -1;
   int severity_fatal = -1;
   tree message = NULL_TREE;
-  bool first = true;
   bool bad = false;
   location_t loc = c_parser_peek_token (parser)->location;
 
@@ -23551,13 +23568,10 @@ c_parser_omp_error (c_parser *parser, enum pragma_context context)
 
   while (c_parser_next_token_is_not (parser, CPP_PRAGMA_EOL))
     {
-      if (!first
-	  && c_parser_next_token_is (parser, CPP_COMMA)
+      if (c_parser_next_token_is (parser, CPP_COMMA)
 	  && c_parser_peek_2nd_token (parser)->type == CPP_NAME)
 	c_parser_consume_token (parser);
 
-      first = false;
-
       if (!c_parser_next_token_is (parser, CPP_NAME))
 	break;
 
@@ -23713,7 +23727,6 @@ c_parser_omp_error (c_parser *parser, enum pragma_context context)
 static void
 c_parser_omp_assumption_clauses (c_parser *parser, bool is_assume)
 {
-  bool first = true;
   bool no_openmp = false;
   bool no_openmp_routines = false;
   bool no_parallelism = false;
@@ -23729,13 +23742,10 @@ c_parser_omp_assumption_clauses (c_parser *parser, bool is_assume)
 
   while (c_parser_next_token_is_not (parser, CPP_PRAGMA_EOL))
     {
-      if (!first
-	  && c_parser_next_token_is (parser, CPP_COMMA)
+      if (c_parser_next_token_is (parser, CPP_COMMA)
 	  && c_parser_peek_2nd_token (parser)->type == CPP_NAME)
 	c_parser_consume_token (parser);
 
-      first = false;
-
       if (!c_parser_next_token_is (parser, CPP_NAME))
 	break;
 
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index e685f190b3d..9bdc60949f4 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -40443,12 +40443,7 @@ cp_parser_omp_all_clauses (cp_parser *parser, omp_clause_mask mask,
       if (nested && cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_PAREN))
 	break;
 
-      if (!first
-	  /* OpenMP 5.1 allows optional comma in between directive-name and
-	     clauses everywhere, but as we aren't done with OpenMP 5.0
-	     implementation yet, let's allow it for now only in C++11
-	     attributes.  */
-	  || (parser->lexer->in_omp_attribute_pragma && nested != 2))
+      if (!first || nested != 2)
 	{
 	  if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
 	    cp_lexer_consume_token (parser->lexer);
@@ -40881,9 +40876,7 @@ cp_parser_omp_allocate (cp_parser *parser, cp_token *pragma_tok)
   location_t loc = pragma_tok->location;
   tree nl = cp_parser_omp_var_list (parser, OMP_CLAUSE_ALLOCATE, NULL_TREE);
 
-  /* For now only in C++ attributes, do it always for OpenMP 5.1.  */
-  if (parser->lexer->in_omp_attribute_pragma
-      && cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
+  if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
       && cp_lexer_nth_token_is (parser->lexer, 2, CPP_NAME))
     cp_lexer_consume_token (parser->lexer);
 
@@ -41004,7 +40997,6 @@ cp_parser_omp_atomic (cp_parser *parser, cp_token *pragma_tok, bool openacc)
   enum tree_code code = ERROR_MARK, opcode = NOP_EXPR;
   enum omp_memory_order memory_order = OMP_MEMORY_ORDER_UNSPECIFIED;
   bool structured_block = false;
-  bool first = true;
   tree clauses = NULL_TREE;
   bool capture = false;
   bool compare = false;
@@ -41015,14 +41007,10 @@ cp_parser_omp_atomic (cp_parser *parser, cp_token *pragma_tok, bool openacc)
 
   while (cp_lexer_next_token_is_not (parser->lexer, CPP_PRAGMA_EOL))
     {
-      /* For now only in C++ attributes, do it always for OpenMP 5.1.  */
-      if ((!first || parser->lexer->in_omp_attribute_pragma)
-	  && cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
+      if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
 	  && cp_lexer_nth_token_is (parser->lexer, 2, CPP_NAME))
 	cp_lexer_consume_token (parser->lexer);
 
-      first = false;
-
       if (cp_lexer_next_token_is (parser->lexer, CPP_NAME))
 	{
 	  tree id = cp_lexer_peek_token (parser->lexer)->u.value;
@@ -41976,11 +41964,9 @@ cp_parser_omp_depobj (cp_parser *parser, cp_token *pragma_tok)
 
   tree clause = NULL_TREE;
   enum omp_clause_depend_kind kind = OMP_CLAUSE_DEPEND_INVALID;
-  location_t c_loc = cp_lexer_peek_token (parser->lexer)->location;
-  /* For now only in C++ attributes, do it always for OpenMP 5.1.  */
-  if (parser->lexer->in_omp_attribute_pragma
-      && cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
+  if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
     cp_lexer_consume_token (parser->lexer);
+  location_t c_loc = cp_lexer_peek_token (parser->lexer)->location;
   if (cp_lexer_next_token_is (parser->lexer, CPP_NAME))
     {
       tree id = cp_lexer_peek_token (parser->lexer)->u.value;
@@ -42063,9 +42049,7 @@ static void
 cp_parser_omp_flush (cp_parser *parser, cp_token *pragma_tok)
 {
   enum memmodel mo = MEMMODEL_LAST;
-  /* For now only in C++ attributes, do it always for OpenMP 5.1.  */
-  if (parser->lexer->in_omp_attribute_pragma
-      && cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
+  if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
       && cp_lexer_nth_token_is (parser->lexer, 2, CPP_NAME))
     cp_lexer_consume_token (parser->lexer);
   if (cp_lexer_next_token_is (parser->lexer, CPP_NAME))
@@ -42790,8 +42774,7 @@ cp_parser_omp_scan_loop_body (cp_parser *parser)
 
       cp_lexer_consume_token (parser->lexer);
 
-      if (parser->lexer->in_omp_attribute_pragma
-	  && cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
+      if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
 	cp_lexer_consume_token (parser->lexer);
 
       if (cp_lexer_next_token_is (parser->lexer, CPP_NAME))
@@ -43593,9 +43576,7 @@ cp_parser_omp_ordered (cp_parser *parser, cp_token *pragma_tok,
   location_t loc = pragma_tok->location;
   int n = 1;
 
-  /* For now only in C++ attributes, do it always for OpenMP 5.1.  */
-  if (parser->lexer->in_omp_attribute_pragma
-      && cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
+  if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
     n = 2;
 
   if (cp_lexer_nth_token_is (parser->lexer, n, CPP_NAME))
@@ -45949,7 +45930,6 @@ static void
 cp_parser_omp_assumption_clauses (cp_parser *parser, cp_token *pragma_tok,
 				  bool is_assume)
 {
-  bool first = true;
   bool no_openmp = false;
   bool no_openmp_routines = false;
   bool no_parallelism = false;
@@ -45965,14 +45945,10 @@ cp_parser_omp_assumption_clauses (cp_parser *parser, cp_token *pragma_tok,
 
   while (cp_lexer_next_token_is_not (parser->lexer, CPP_PRAGMA_EOL))
     {
-      /* For now only in C++ attributes, do it always for OpenMP 5.1.  */
-      if ((!first || parser->lexer->in_omp_attribute_pragma)
-	  && cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
+      if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
 	  && cp_lexer_nth_token_is (parser->lexer, 2, CPP_NAME))
 	cp_lexer_consume_token (parser->lexer);
 
-      first = false;
-
       if (!cp_lexer_next_token_is (parser->lexer, CPP_NAME))
 	break;
 
@@ -46209,9 +46185,7 @@ cp_finish_omp_declare_variant (cp_parser *parser, cp_token *pragma_tok,
   location_t finish_loc = get_finish (varid.get_location ());
   location_t varid_loc = make_location (caret_loc, start_loc, finish_loc);
 
-  /* For now only in C++ attributes, do it always for OpenMP 5.1.  */
-  if (parser->lexer->in_omp_attribute_pragma
-      && cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
+  if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
       && cp_lexer_nth_token_is (parser->lexer, 2, CPP_NAME))
     cp_lexer_consume_token (parser->lexer);
 
@@ -46287,11 +46261,6 @@ cp_parser_late_parsing_omp_declare_simd (cp_parser *parser, tree attrs)
       cp_lexer_consume_token (parser->lexer);
       if (strcmp (kind, "simd") == 0)
 	{
-	  /* For now only in C++ attributes, do it always for OpenMP 5.1.
-	  if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
-	      && cp_lexer_nth_token_is (parser->lexer, 2, CPP_NAME))
-	    cp_lexer_consume_token (parser->lexer);  */
-
 	  cl = cp_parser_omp_all_clauses (parser, OMP_DECLARE_SIMD_CLAUSE_MASK,
 					  "#pragma omp declare simd",
 					  pragma_tok);
@@ -46549,9 +46518,7 @@ cp_parser_omp_declare_target (cp_parser *parser, cp_token *pragma_tok)
   int device_type = 0;
   bool only_device_type = true;
   if (cp_lexer_next_token_is (parser->lexer, CPP_NAME)
-      /* For now only in C++ attributes, do it always for OpenMP 5.1.  */
-      || (parser->lexer->in_omp_attribute_pragma
-	  && cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
+      || (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
 	  && cp_lexer_nth_token_is (parser->lexer, 2, CPP_NAME)))
     clauses
       = cp_parser_omp_all_clauses (parser, OMP_DECLARE_TARGET_CLAUSE_MASK,
@@ -46801,9 +46768,7 @@ cp_parser_omp_declare_reduction_exprs (tree fndecl, cp_parser *parser)
   if (!cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN))
     return false;
 
-  /* For now only in C++ attributes, do it always for OpenMP 5.1.  */
-  if (parser->lexer->in_omp_attribute_pragma
-      && cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
+  if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
       && cp_lexer_nth_token_is (parser->lexer, 2, CPP_NAME))
     cp_lexer_consume_token (parser->lexer);
 
@@ -47235,20 +47200,15 @@ cp_parser_omp_declare (cp_parser *parser, cp_token *pragma_tok,
 static bool
 cp_parser_omp_requires (cp_parser *parser, cp_token *pragma_tok)
 {
-  bool first = true;
   enum omp_requires new_req = (enum omp_requires) 0;
 
   location_t loc = pragma_tok->location;
   while (cp_lexer_next_token_is_not (parser->lexer, CPP_PRAGMA_EOL))
     {
-      /* For now only in C++ attributes, do it always for OpenMP 5.1.  */
-      if ((!first || parser->lexer->in_omp_attribute_pragma)
-	  && cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
+      if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
 	  && cp_lexer_nth_token_is (parser->lexer, 2, CPP_NAME))
 	cp_lexer_consume_token (parser->lexer);
 
-      first = false;
-
       if (cp_lexer_next_token_is (parser->lexer, CPP_NAME))
 	{
 	  tree id = cp_lexer_peek_token (parser->lexer)->u.value;
@@ -47402,20 +47362,15 @@ cp_parser_omp_error (cp_parser *parser, cp_token *pragma_tok,
   int at_compilation = -1;
   int severity_fatal = -1;
   tree message = NULL_TREE;
-  bool first = true;
   bool bad = false;
   location_t loc = pragma_tok->location;
 
   while (cp_lexer_next_token_is_not (parser->lexer, CPP_PRAGMA_EOL))
     {
-      /* For now only in C++ attributes, do it always for OpenMP 5.1.  */
-      if ((!first || parser->lexer->in_omp_attribute_pragma)
-	  && cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
+      if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)
 	  && cp_lexer_nth_token_is (parser->lexer, 2, CPP_NAME))
 	cp_lexer_consume_token (parser->lexer);
 
-      first = false;
-
       if (cp_lexer_next_token_is_not (parser->lexer, CPP_NAME))
 	break;
 
diff --git a/gcc/testsuite/c-c++-common/gomp/clauses-6.c b/gcc/testsuite/c-c++-common/gomp/clauses-6.c
new file mode 100644
index 00000000000..3502647ffb4
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/clauses-6.c
@@ -0,0 +1,604 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-std=c99" { target c } } */
+
+typedef enum omp_allocator_handle_t
+#if __cplusplus >= 201103L
+: __UINTPTR_TYPE__
+#endif
+{
+  omp_null_allocator = 0,
+  omp_default_mem_alloc = 1,
+  omp_large_cap_mem_alloc = 2,
+  omp_const_mem_alloc = 3,
+  omp_high_bw_mem_alloc = 4,
+  omp_low_lat_mem_alloc = 5,
+  omp_cgroup_mem_alloc = 6,
+  omp_pteam_mem_alloc = 7,
+  omp_thread_mem_alloc = 8,
+  __omp_allocator_handle_t_max__ = __UINTPTR_MAX__
+} omp_allocator_handle_t;
+
+typedef enum omp_sync_hint_t {
+omp_sync_hint_none = 0x0,
+omp_lock_hint_none = omp_sync_hint_none,
+omp_sync_hint_uncontended = 0x1,
+omp_lock_hint_uncontended = omp_sync_hint_uncontended,
+omp_sync_hint_contended = 0x2,
+omp_lock_hint_contended = omp_sync_hint_contended,
+omp_sync_hint_nonspeculative = 0x4,
+omp_lock_hint_nonspeculative = omp_sync_hint_nonspeculative,
+omp_sync_hint_speculative = 0x8,
+omp_lock_hint_speculative = omp_sync_hint_speculative
+} omp_sync_hint_t;
+  
+typedef struct __attribute__((__aligned__ (sizeof (void *)))) omp_depend_t {
+  char __omp_depend_t__[2 * sizeof (void *)];
+} omp_depend_t;
+
+int t;
+#pragma omp threadprivate (t)
+
+#pragma omp declare target
+int f, l, ll, r, r2;
+
+void
+foo (int d, int m, int i1, int i2, int p, int *idp, int s,
+     int nte, int tl, int nth, int g, int nta, int fi, int pp, int *q, int ntm)
+{
+  #pragma omp distribute parallel for, \
+    private (p), firstprivate (f), collapse(1), dist_schedule(static, 16), \
+    if (parallel: i2), default(shared), shared(s), reduction(+:r), num_threads (nth), proc_bind(spread), \
+    lastprivate (l), schedule(static, 4), order(concurrent), allocate (omp_default_mem_alloc:f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp distribute parallel for simd, \
+    private (p), firstprivate (f), collapse(1), dist_schedule(static, 16), \
+    if (parallel: i2), if(simd: i1), default(shared), shared(s), reduction(+:r), num_threads (nth), proc_bind(spread), \
+    lastprivate (l), schedule(static, 4), nontemporal(ntm), \
+    safelen(8), simdlen(4), aligned(q: 32), order(concurrent), allocate (omp_default_mem_alloc:f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp distribute simd, \
+    private (p), firstprivate (f), collapse(1), dist_schedule(static, 16), \
+    safelen(8), simdlen(4), aligned(q: 32), reduction(+:r), if(i1), nontemporal(ntm), \
+    order(concurrent), allocate (omp_default_mem_alloc:f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+}
+
+void
+qux (int p)
+{
+  #pragma omp loop, bind(teams), order(concurrent), \
+    private (p), lastprivate (l), collapse(1), reduction(+:r)
+  for (l = 0; l < 64; ++l)
+    ll++;
+}
+#pragma omp end declare target
+
+void
+baz (int d, int m, int i1, int i2, int p, int *idp, int s,
+     int nte, int tl, int nth, int g, int nta, int fi, int pp, int *q, int ntm)
+{
+  #pragma omp distribute parallel for, \
+    private (p), firstprivate (f), collapse(1), dist_schedule(static, 16), \
+    if (parallel: i2), default(shared), shared(s), reduction(+:r), num_threads (nth), proc_bind(spread), \
+    lastprivate (l), schedule(static, 4), copyin(t), allocate (p)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp distribute parallel for, \
+    private (p), firstprivate (f), collapse(1), dist_schedule(static, 16), \
+    if (parallel: i2), default(shared), shared(s), reduction(+:r), num_threads (nth), proc_bind(spread), \
+    lastprivate (l), schedule(static, 4), order(concurrent), allocate (p)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp distribute parallel for simd, \
+    private (p), firstprivate (f), collapse(1), dist_schedule(static, 16), \
+    if (parallel: i2), if(simd: i1), default(shared), shared(s), reduction(+:r), num_threads (nth), proc_bind(spread), \
+    lastprivate (l), schedule(static, 4), nontemporal(ntm), \
+    safelen(8), simdlen(4), aligned(q: 32), copyin(t), allocate (f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp distribute parallel for simd, \
+    private (p), firstprivate (f), collapse(1), dist_schedule(static, 16), \
+    if (parallel: i2), if(simd: i1), default(shared), shared(s), reduction(+:r), num_threads (nth), proc_bind(spread), \
+    lastprivate (l), schedule(static, 4), nontemporal(ntm), \
+    safelen(8), simdlen(4), aligned(q: 32), order(concurrent), allocate (f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp distribute simd, \
+    private (p), firstprivate (f), collapse(1), dist_schedule(static, 16), \
+    safelen(8), simdlen(4), aligned(q: 32), reduction(+:r), if(i1), nontemporal(ntm), \
+    order(concurrent), allocate (f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp loop, bind(parallel), order(concurrent), \
+    private (p), lastprivate (l), collapse(1), reduction(+:r)
+  for (l = 0; l < 64; ++l)
+    ll++;
+}
+
+void
+bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int hda, int s,
+     int nte, int tl, int nth, int g, int nta, int fi, int pp, int *q, int *dd, int ntm,
+     int n1, int n2)
+{
+  #pragma omp for simd, \
+    private (p), firstprivate (f), lastprivate (l), linear (ll:1), reduction(+:r), schedule(static, 4), collapse(1), nowait, \
+    safelen(8), simdlen(4), aligned(q: 32), nontemporal(ntm), if(i1), order(concurrent), allocate (f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp parallel for, \
+    private (p), firstprivate (f), if (parallel: i2), default(shared), shared(s), copyin(t), reduction(+:r), num_threads (nth), proc_bind(spread), \
+    lastprivate (l), linear (ll:1), ordered, schedule(static, 4), collapse(1), allocate (f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp parallel for, \
+    private (p), firstprivate (f), if (parallel: i2), default(shared), shared(s), copyin(t), reduction(+:r), num_threads (nth), proc_bind(spread), \
+    lastprivate (l), linear (ll:1), schedule(static, 4), collapse(1), order(concurrent), allocate (f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp parallel for simd, \
+    private (p), firstprivate (f), if (i2), default(shared), shared(s), copyin(t), reduction(+:r), num_threads (nth), proc_bind(spread), \
+    lastprivate (l), linear (ll:1), schedule(static, 4), collapse(1), \
+    safelen(8), simdlen(4), aligned(q: 32), nontemporal(ntm), order(concurrent), allocate (f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp parallel sections, \
+    private (p), firstprivate (f), if (parallel: i2), default(shared), shared(s), copyin(t), reduction(+:r), num_threads (nth), proc_bind(spread), \
+    lastprivate (l), allocate (f)
+  {
+    #pragma omp section
+    {}
+    #pragma omp section
+    {}
+  }
+  #pragma omp target parallel, \
+    device(d), map (tofrom: m), if (target: i1), private (p), firstprivate (f), defaultmap(tofrom: scalar), is_device_ptr (idp), \
+    if (parallel: i2), default(shared), shared(s), reduction(+:r), num_threads (nth), proc_bind(spread), \
+    nowait, depend(inout: dd[0]), allocate (omp_default_mem_alloc:f), in_reduction(+:r2), has_device_addr(hda)
+    ;
+  #pragma omp target parallel for, \
+    device(d), map (tofrom: m), if (target: i1), private (p), firstprivate (f), defaultmap(tofrom: scalar), is_device_ptr (idp), \
+    if (parallel: i2), default(shared), shared(s), reduction(+:r), num_threads (nth), proc_bind(spread), \
+    lastprivate (l), linear (ll:1), ordered, schedule(static, 4), collapse(1), nowait, depend(inout: dd[0]), \
+    allocate (omp_default_mem_alloc:f), in_reduction(+:r2), has_device_addr(hda)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp target parallel for, \
+    device(d), map (tofrom: m), if (target: i1), private (p), firstprivate (f), defaultmap(tofrom: scalar), is_device_ptr (idp), \
+    if (parallel: i2), default(shared), shared(s), reduction(+:r), num_threads (nth), proc_bind(spread), \
+    lastprivate (l), linear (ll:1), schedule(static, 4), collapse(1), nowait, depend(inout: dd[0]), order(concurrent), \
+    allocate (omp_default_mem_alloc:f), in_reduction(+:r2), has_device_addr(hda)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp target parallel for simd, \
+    device(d), map (tofrom: m), if (target: i1), private (p), firstprivate (f), defaultmap(tofrom: scalar), is_device_ptr (idp), \
+    if (parallel: i2), default(shared), shared(s), reduction(+:r), num_threads (nth), proc_bind(spread), \
+    lastprivate (l), linear (ll:1), schedule(static, 4), collapse(1), \
+    safelen(8), simdlen(4), aligned(q: 32), nowait, depend(inout: dd[0]), nontemporal(ntm), if (simd: i3), order(concurrent), \
+    allocate (omp_default_mem_alloc:f), in_reduction(+:r2), has_device_addr(hda)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp target teams, \
+    device(d), map (tofrom: m), if (target: i1), private (p), firstprivate (f), defaultmap(tofrom: scalar), is_device_ptr (idp), \
+    shared(s), default(shared), reduction(+:r), num_teams(nte - 1:nte), thread_limit(tl), nowait depend(inout: dd[0]), \
+    allocate (omp_default_mem_alloc:f), in_reduction(+:r2), has_device_addr(hda)
+    ;
+  #pragma omp target teams distribute, \
+    device(d), map (tofrom: m), if (target: i1), private (p), firstprivate (f), defaultmap(tofrom: scalar), is_device_ptr (idp), \
+    shared(s), default(shared), reduction(+:r), num_teams(nte), thread_limit(tl), order(concurrent), \
+    collapse(1), dist_schedule(static, 16), nowait, depend(inout: dd[0]), allocate (omp_default_mem_alloc:f), in_reduction(+:r2), \
+    has_device_addr(hda)
+  for (int i = 0; i < 64; i++)
+    ;
+  #pragma omp target teams distribute parallel for, \
+    device(d), map (tofrom: m), if (target: i1), private (p), firstprivate (f), defaultmap(tofrom: scalar), is_device_ptr (idp), \
+    shared(s), default(shared), reduction(+:r), num_teams(nte-1:nte), thread_limit(tl), \
+    collapse(1), dist_schedule(static, 16), \
+    if (parallel: i2), num_threads (nth), proc_bind(spread), \
+    lastprivate (l), schedule(static, 4), nowait, depend(inout: dd[0]), order(concurrent), \
+     allocate (omp_default_mem_alloc:f), in_reduction(+:r2), has_device_addr(hda)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp target teams distribute parallel for simd, \
+    device(d), map (tofrom: m), if (target: i1), private (p), firstprivate (f), defaultmap(tofrom: scalar), is_device_ptr (idp), \
+    shared(s), default(shared), reduction(+:r), num_teams(nte), thread_limit(tl), \
+    collapse(1), dist_schedule(static, 16), \
+    if (parallel: i2), num_threads (nth), proc_bind(spread), \
+    lastprivate (l), schedule(static, 4), order(concurrent), \
+    safelen(8), simdlen(4), aligned(q: 32), nowait, depend(inout: dd[0]), nontemporal(ntm), if (simd: i3), \
+    allocate (omp_default_mem_alloc:f), in_reduction(+:r2), has_device_addr(hda)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp target teams distribute simd, \
+    device(d), map (tofrom: m), if (i1), private (p), firstprivate (f), defaultmap(tofrom: scalar), is_device_ptr (idp), \
+    shared(s), default(shared), reduction(+:r), num_teams(nte-1:nte), thread_limit(tl), \
+    collapse(1), dist_schedule(static, 16), order(concurrent), \
+    safelen(8), simdlen(4), aligned(q: 32), nowait depend(inout: dd[0]), nontemporal(ntm), \
+    allocate (omp_default_mem_alloc:f), in_reduction(+:r2), has_device_addr(hda)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp target simd, \
+    device(d), map (tofrom: m), if (target: i1), private (p), firstprivate (f), defaultmap(tofrom: scalar), is_device_ptr (idp), \
+    safelen(8), simdlen(4), lastprivate (l), linear(ll: 1), aligned(q: 32), reduction(+:r), \
+    nowait depend(inout: dd[0]), nontemporal(ntm), if(simd:i3), order(concurrent), \
+    allocate (omp_default_mem_alloc:f), in_reduction(+:r2), has_device_addr(hda)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp taskgroup, task_reduction(+:r2), allocate (r2)
+  #pragma omp taskloop simd, \
+    private (p), firstprivate (f), lastprivate (l), shared (s), default(shared), grainsize (g), collapse(1), untied, if(taskloop: i1), if(simd: i2), final(fi), mergeable, priority (pp), \
+    safelen(8), simdlen(4), linear(ll: 1), aligned(q: 32), reduction(default, +:r), in_reduction(+:r2), nontemporal(ntm), \
+    order(concurrent), allocate (f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp taskgroup, task_reduction(+:r), allocate (r)
+  #pragma omp taskloop simd, \
+    private (p), firstprivate (f), lastprivate (l), shared (s), default(shared), grainsize (g), collapse(1), untied, if(i1), final(fi), mergeable, nogroup, priority (pp), \
+    safelen(8), simdlen(4), linear(ll: 1), aligned(q: 32), in_reduction(+:r), nontemporal(ntm), \
+    order(concurrent), allocate (f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp taskwait
+  #pragma omp taskloop simd, \
+    private (p), firstprivate (f), lastprivate (l), shared (s), default(shared), num_tasks (nta), collapse(1), if(taskloop: i1), final(fi), priority (pp), \
+    safelen(8), simdlen(4), linear(ll: 1), aligned(q: 32), reduction(+:r), if (simd: i3), nontemporal(ntm), \
+    order(concurrent), allocate (f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp target, nowait, depend(inout: dd[0]), in_reduction(+:r2)
+  #pragma omp teams distribute, \
+    private(p), firstprivate (f), shared(s), default(shared), reduction(+:r), num_teams(nte), thread_limit(tl), \
+    collapse(1), dist_schedule(static, 16), allocate (omp_default_mem_alloc: f), order(concurrent)
+  for (int i = 0; i < 64; i++)
+    ;
+  #pragma omp target
+  #pragma omp teams distribute parallel for, \
+    private(p), firstprivate (f), shared(s), default(shared), reduction(+:r), num_teams(nte-1:nte), thread_limit(tl), \
+    collapse(1), dist_schedule(static, 16), \
+    if (parallel: i2), num_threads (nth), proc_bind(spread), \
+    lastprivate (l), schedule(static, 4), order(concurrent), allocate (omp_default_mem_alloc: f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp target
+  #pragma omp teams distribute parallel for simd, \
+    private(p), firstprivate (f), shared(s), default(shared), reduction(+:r), num_teams(nte), thread_limit(tl), \
+    collapse(1), dist_schedule(static, 16), \
+    if (parallel: i2), num_threads (nth), proc_bind(spread), \
+    lastprivate (l), schedule(static, 4), order(concurrent), \
+    safelen(8), simdlen(4), aligned(q: 32), if (simd: i3), nontemporal(ntm), \
+    allocate (omp_default_mem_alloc: f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp target
+  #pragma omp teams distribute simd, \
+    private(p), firstprivate (f), shared(s), default(shared), reduction(+:r), num_teams(nte-1:nte), thread_limit(tl), \
+    collapse(1), dist_schedule(static, 16), order(concurrent), \
+    safelen(8), simdlen(4), aligned(q: 32), if(i3), nontemporal(ntm), \
+    allocate (omp_default_mem_alloc: f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp teams distribute parallel for, \
+    private(p), firstprivate (f), shared(s), default(shared), reduction(+:r), num_teams(nte), thread_limit(tl), \
+    collapse(1), dist_schedule(static, 16), \
+    if (parallel: i2), num_threads (nth), proc_bind(spread), \
+    lastprivate (l), schedule(static, 4), copyin(t), allocate (f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp teams distribute parallel for, \
+    private(p), firstprivate (f), shared(s), default(shared), reduction(+:r), num_teams(nte-1:nte), thread_limit(tl), \
+    collapse(1), dist_schedule(static, 16), order(concurrent), \
+    if (parallel: i2), num_threads (nth), proc_bind(spread), \
+    lastprivate (l), schedule(static, 4), allocate (f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp teams distribute parallel for simd, \
+    private(p), firstprivate (f), shared(s), default(shared), reduction(+:r), num_teams(nte), thread_limit(tl), \
+    collapse(1), dist_schedule(static, 16), \
+    if (parallel: i2), num_threads (nth), proc_bind(spread), \
+    lastprivate (l), schedule(static, 4), \
+    safelen(8), simdlen(4), aligned(q: 32), if (simd: i3), nontemporal(ntm), copyin(t), \
+    allocate (f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp teams distribute parallel for simd, \
+    private(p), firstprivate (f), shared(s), default(shared), reduction(+:r), num_teams(nte-1:nte), thread_limit(tl), \
+    collapse(1), dist_schedule(static, 16), \
+    if (parallel: i2), num_threads (nth), proc_bind(spread), \
+    lastprivate (l), schedule(static, 4), order(concurrent), \
+    safelen(8), simdlen(4), aligned(q: 32), if (simd: i3), nontemporal(ntm), \
+    allocate (f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp teams distribute simd, \
+    private(p), firstprivate (f), shared(s), default(shared), reduction(+:r), num_teams(nte), thread_limit(tl), \
+    collapse(1), dist_schedule(static, 16), order(concurrent), \
+    safelen(8), simdlen(4), aligned(q: 32), if(i3), nontemporal(ntm), allocate(f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp parallel master, \
+    private (p), firstprivate (f), if (parallel: i2), default(shared), shared(s), reduction(+:r), \
+    num_threads (nth), proc_bind(spread), copyin(t), allocate (f)
+    ;
+  #pragma omp parallel masked, \
+    private (p), firstprivate (f), if (parallel: i2), default(shared), shared(s), reduction(+:r), \
+    num_threads (nth), proc_bind(spread), copyin(t), allocate (f), filter (d)
+    ;
+  #pragma omp taskgroup, task_reduction (+:r2), allocate (r2)
+  #pragma omp master taskloop, \
+    private (p), firstprivate (f), lastprivate (l), shared (s), default(shared), grainsize (g), collapse(1), untied, if(taskloop: i1), final(fi), mergeable, priority (pp), \
+    reduction(default, +:r), in_reduction(+:r2), allocate (f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp taskgroup, task_reduction (+:r2), allocate (r2)
+  #pragma omp masked taskloop, \
+    private (p), firstprivate (f), lastprivate (l), shared (s), default(shared), grainsize (g), collapse(1), untied, if(taskloop: i1), final(fi), mergeable, priority (pp), \
+    reduction(default, +:r), in_reduction(+:r2), allocate (f), filter (d)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp taskgroup, task_reduction (+:r2), allocate (r2)
+  #pragma omp master taskloop simd, \
+    private (p), firstprivate (f), lastprivate (l), shared (s), default(shared), grainsize (g), collapse(1), untied, if(taskloop: i1), if(simd: i2), final(fi), mergeable, priority (pp), \
+    safelen(8), simdlen(4), linear(ll: 1), aligned(q: 32), reduction(default, +:r), in_reduction(+:r2), nontemporal(ntm), \
+    order(concurrent), allocate (f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp taskgroup, task_reduction (+:r2), allocate (r2)
+  #pragma omp masked taskloop simd, \
+    private (p), firstprivate (f), lastprivate (l), shared (s), default(shared), grainsize (g), collapse(1), untied, if(taskloop: i1), if(simd: i2), final(fi), mergeable, priority (pp), \
+    safelen(8), simdlen(4), linear(ll: 1), aligned(q: 32), reduction(default, +:r), in_reduction(+:r2), nontemporal(ntm), \
+    order(concurrent), allocate (f), filter (d)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp parallel master taskloop, \
+    private (p), firstprivate (f), lastprivate (l), shared (s), default(shared), grainsize (g), collapse(1), untied, if(taskloop: i1), final(fi), mergeable, priority (pp), \
+    reduction(default, +:r), if (parallel: i2), num_threads (nth), proc_bind(spread), copyin(t), allocate (f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp parallel masked taskloop, \
+    private (p), firstprivate (f), lastprivate (l), shared (s), default(shared), grainsize (g), collapse(1), untied, if(taskloop: i1), final(fi), mergeable, priority (pp), \
+    reduction(default, +:r), if (parallel: i2), num_threads (nth), proc_bind(spread), copyin(t), allocate (f), filter (d)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp parallel master taskloop simd, \
+    private (p), firstprivate (f), lastprivate (l), shared (s), default(shared), grainsize (g), collapse(1), untied, if(taskloop: i1), if(simd: i2), final(fi), mergeable, priority (pp), \
+    safelen(8), simdlen(4), linear(ll: 1), aligned(q: 32), reduction(default, +:r), nontemporal(ntm), if (parallel: i2), num_threads (nth), proc_bind(spread), copyin(t), \
+    order(concurrent), allocate (f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp parallel masked taskloop simd, \
+    private (p), firstprivate (f), lastprivate (l), shared (s), default(shared), grainsize (g), collapse(1), untied, if(taskloop: i1), if(simd: i2), final(fi), mergeable, priority (pp), \
+    safelen(8), simdlen(4), linear(ll: 1), aligned(q: 32), reduction(default, +:r), nontemporal(ntm), if (parallel: i2), num_threads (nth), proc_bind(spread), copyin(t), \
+    order(concurrent), allocate (f), filter (d)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp taskgroup, task_reduction (+:r2), allocate (r2)
+  #pragma omp master taskloop, \
+    private (p), firstprivate (f), lastprivate (l), shared (s), default(shared), num_tasks (nta), collapse(1), untied, if(i1), final(fi), mergeable, priority (pp), \
+    reduction(default, +:r), in_reduction(+:r2)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp taskgroup, task_reduction (+:r2), allocate (r2)
+  #pragma omp mastked taskloop, \
+    private (p), firstprivate (f), lastprivate (l), shared (s), default(shared), num_tasks (nta), collapse(1), untied, if(i1), final(fi), mergeable, priority (pp), \
+    reduction(default, +:r), in_reduction(+:r2), filter (d)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp taskgroup, task_reduction (+:r2), allocate (r2)
+  #pragma omp master taskloop simd, \
+    private (p), firstprivate (f), lastprivate (l), shared (s), default(shared), num_tasks (nta), collapse(1), untied, if(i1), final(fi), mergeable, priority (pp), \
+    safelen(8), simdlen(4), linear(ll: 1), aligned(q: 32), reduction(default, +:r), in_reduction(+:r2), nontemporal(ntm), \
+    order(concurrent), allocate (f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp taskgroup, task_reduction (+:r2), allocate (r2)
+  #pragma omp masked taskloop simd, \
+    private (p), firstprivate (f), lastprivate (l), shared (s), default(shared), num_tasks (nta), collapse(1), untied, if(i1), final(fi), mergeable, priority (pp), \
+    safelen(8), simdlen(4), linear(ll: 1), aligned(q: 32), reduction(default, +:r), in_reduction(+:r2), nontemporal(ntm), \
+    order(concurrent), allocate (f), filter (d)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp parallel master taskloop, \
+    private (p), firstprivate (f), lastprivate (l), shared (s), default(shared), num_tasks (nta), collapse(1), untied, if(i1), final(fi), mergeable, priority (pp), \
+    reduction(default, +:r), num_threads (nth), proc_bind(spread), copyin(t), allocate (f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp parallel masked taskloop, \
+    private (p), firstprivate (f), lastprivate (l), shared (s), default(shared), num_tasks (nta), collapse(1), untied, if(i1), final(fi), mergeable, priority (pp), \
+    reduction(default, +:r), num_threads (nth), proc_bind(spread), copyin(t), allocate (f), filter (d)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp parallel master taskloop simd, \
+    private (p), firstprivate (f), lastprivate (l), shared (s), default(shared), num_tasks (nta), collapse(1), untied, if(i1), final(fi), mergeable, priority (pp), \
+    safelen(8), simdlen(4), linear(ll: 1), aligned(q: 32), reduction(default, +:r), nontemporal(ntm), num_threads (nth), proc_bind(spread), copyin(t), \
+    order(concurrent), allocate (f)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp parallel masked taskloop simd, \
+    private (p), firstprivate (f), lastprivate (l), shared (s), default(shared), num_tasks (nta), collapse(1), untied, if(i1), final(fi), mergeable, priority (pp), \
+    safelen(8), simdlen(4), linear(ll: 1), aligned(q: 32), reduction(default, +:r), nontemporal(ntm), num_threads (nth), proc_bind(spread), copyin(t), \
+    order(concurrent), allocate (f), filter (d)
+  for (int i = 0; i < 64; i++)
+    ll++;
+  #pragma omp loop, bind(thread), order(concurrent), \
+    private (p), lastprivate (l), collapse(1), reduction(+:r)
+  for (l = 0; l < 64; ++l)
+    ll++;
+  #pragma omp parallel loop, \
+    private (p), firstprivate (f), if (parallel: i2), default(shared), shared(s), copyin(t), reduction(+:r), num_threads (nth), proc_bind(spread), \
+    lastprivate (l), collapse(1), bind(parallel), order(concurrent), allocate (f)
+  for (l = 0; l < 64; l++)
+    ll++;
+  #pragma omp parallel loop, \
+    private (p), firstprivate (f), if (parallel: i2), default(shared), shared(s), copyin(t), reduction(+:r), num_threads (nth), proc_bind(spread), \
+    lastprivate (l), collapse(1), allocate (f)
+  for (l = 0; l < 64; l++)
+    ll++;
+  #pragma omp teams loop, \
+    private(p), firstprivate (f), shared(s), default(shared), reduction(+:r), num_teams(nte-1:nte), thread_limit(tl), \
+    collapse(1), lastprivate (l), bind(teams), allocate (f)
+  for (l = 0; l < 64; ++l)
+    ;
+  #pragma omp teams loop, \
+    private(p), firstprivate (f), shared(s), default(shared), reduction(+:r), num_teams(nte), thread_limit(tl), \
+    collapse(1), lastprivate (l), order(concurrent), allocate (f)
+  for (l = 0; l < 64; ++l)
+    ;
+  #pragma omp target parallel loop, \
+    device(d), map (tofrom: m), if (target: i1), private (p), firstprivate (f), defaultmap(tofrom: scalar), is_device_ptr (idp), \
+    if (parallel: i2), default(shared), shared(s), reduction(+:r), num_threads (nth), proc_bind(spread), \
+    nowait depend(inout: dd[0]), lastprivate (l), bind(parallel), order(concurrent), collapse(1), \
+    allocate (omp_default_mem_alloc: f), in_reduction(+:r2), has_device_addr(hda)
+  for (l = 0; l < 64; ++l)
+    ;
+  #pragma omp target parallel loop, \
+    device(d), map (tofrom: m), if (target: i1), private (p), firstprivate (f), defaultmap(tofrom: scalar), is_device_ptr (idp), \
+    if (parallel: i2), default(shared), shared(s), reduction(+:r), num_threads (nth), proc_bind(spread), \
+    nowait depend(inout: dd[0]), lastprivate (l), order(concurrent), collapse(1), \
+    allocate (omp_default_mem_alloc: f), in_reduction(+:r2), has_device_addr(hda)
+  for (l = 0; l < 64; ++l)
+    ;
+  #pragma omp target teams loop, \
+    device(d), map (tofrom: m), if (target: i1), private (p), firstprivate (f), defaultmap(tofrom: scalar), is_device_ptr (idp), \
+    shared(s), default(shared), reduction(+:r), num_teams(nte-1:nte), thread_limit(tl), nowait depend(inout: dd[0]), \
+    lastprivate (l), bind(teams), collapse(1), \
+    allocate (omp_default_mem_alloc: f), in_reduction(+:r2), has_device_addr(hda)
+  for (l = 0; l < 64; ++l)
+    ;
+  #pragma omp target teams loop, \
+    device(d), map (tofrom: m), if (target: i1), private (p), firstprivate (f), defaultmap(tofrom: scalar), is_device_ptr (idp), \
+    shared(s), default(shared), reduction(+:r), num_teams(nte), thread_limit(tl), nowait depend(inout: dd[0]), \
+    lastprivate (l), order(concurrent), collapse(1), \
+    allocate (omp_default_mem_alloc: f), in_reduction(+:r2), has_device_addr(hda)
+  for (l = 0; l < 64; ++l)
+    ;
+  #pragma omp critical
+  ;
+  #pragma omp critical (foobar),hint(omp_sync_hint_none)
+  ;
+  #pragma omp taskwait, depend (inout: dd[0])
+  ;
+  #pragma omp taskgroup, task_reduction(+:r2),allocate (r2)
+  ;
+  #pragma omp atomic, update,seq_cst,hint(omp_sync_hint_none)
+  p++;
+  #pragma omp atomic, read, hint(omp_sync_hint_none),relaxed
+  f = p;
+  #pragma omp atomic,write, release hint(omp_sync_hint_none)
+  p = f;
+  #pragma omp flush
+  ;
+  #pragma omp flush, acq_rel
+  ;
+  #pragma omp flush, acquire
+  ;
+  #pragma omp flush, release
+  ;
+  #pragma omp flush, seq_cst
+  ;
+  #pragma omp flush (p, f)
+  ;
+  #pragma omp simd, \
+    private (p),lastprivate (l),linear (ll:1),reduction(+:r),collapse(1),safelen(8),simdlen(4),aligned(q: 32), \
+    nontemporal(ntm),if(i1)
+  for (int i = 0; i < 64; i++)
+    #pragma omp ordered, simd
+      ll++;
+  #pragma omp for, \
+    private (p),firstprivate (f),lastprivate (l),linear (ll:1),reduction(+:r),schedule(static, 4),collapse(1),nowait, \
+    ordered, allocate (f)
+  for (int i = 0; i < 64; i++)
+    #pragma omp ordered, threads
+      ll++;
+  #pragma omp for, ordered (1)
+  for (l = 0; l < 64; l++)
+    {
+      #pragma omp ordered, depend (sink: l - 1)
+      ;
+      #pragma omp ordered, depend (source)
+      ;
+    }
+  extern omp_depend_t depobj;
+  #pragma omp depobj(depobj),depend(in : dd[0])
+  ;
+  #pragma omp parallel
+  {
+    if (p) {
+      #pragma omp cancel, parallel
+      ;
+    } else {
+      #pragma omp cancellation point, parallel
+      ;
+    }
+  }
+  #pragma omp scope, private (p), firstprivate (f), reduction(+:r), nowait, \
+    allocate(omp_default_mem_alloc: r)
+    ;
+  #pragma omp scope, private (p), firstprivate (f), reduction(task, +:r), \
+    allocate (omp_default_mem_alloc: f)
+    ;
+  extern int t2;
+  #pragma omp threadprivate (t2)
+  extern int t2;
+  #pragma omp declare reduction (dr: int: omp_out += omp_in),initializer (omp_priv = 0)
+  #pragma omp assume, no_openmp, no_openmp_routines, no_parallelism, \
+		      absent (atomic, barrier, cancel, cancellation point), \
+		      absent (critical, depobj), \
+		      absent (distribute, flush, loop, masked, master, nothing, ordered), \
+		      absent (parallel, scan, scope, section, sections, simd, single, task), \
+		      absent (taskgroup, taskloop, taskwait, taskyield), \
+		      absent (target, teams, for, error), holds (n1 < n2)
+  if (0)
+    ;
+  #pragma omp assume, contains (simd)
+  #pragma omp for simd
+  for (int i = 0; i < 64; i++)
+    ;
+}
+
+void corge1 ();
+
+void
+corge ()
+{
+  #pragma omp declare variant (corge1),match (construct={parallel,for})
+  extern void corge2 ();
+  #pragma omp parallel
+  #pragma omp  for
+  for (int i = 0; i < 5; i++)
+    corge2 ();
+  #pragma omp declare simd, simdlen(4),linear(l),aligned(p:4),uniform(p),inbranch
+  #pragma omp declare simd,simdlen(8),notinbranch
+  extern int corge3 (int l, int *p);
+  #pragma omp declare simd, simdlen(4),linear(l),aligned(p:4),uniform(p),inbranch
+  #pragma omp declare simd, simdlen(8),notinbranch
+  extern int corge4 (int l, int *p);
+  #pragma omp declare simd, simdlen(4),linear(l),aligned(p:4),uniform(p),inbranch
+  #pragma omp declare simd, simdlen(8),notinbranch
+  extern int corge5 (int l, int *p);
+  #pragma omp declare target
+  extern void corge6 ();
+  #pragma omp end declare target
+}
+
+int
+garply (int a, int *c, int *d, int *e, int *f)
+{
+  int i;
+  #pragma omp simd, reduction (inscan, +: a)
+  for (i = 0; i < 64; i++)
+    {
+      d[i] = a;
+      #pragma omp scan, exclusive (a)
+      a += c[i];
+    }
+  #pragma omp simd, reduction (inscan, +: a)
+  for (i = 0; i < 64; i++)
+    {
+      a += c[i];
+      #pragma omp scan inclusive (a)
+      d[i] = a;
+    }
+  return a;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/declare-variant-2.c b/gcc/testsuite/c-c++-common/gomp/declare-variant-2.c
index 5554059bd60..3c2c12c9e03 100644
--- a/gcc/testsuite/c-c++-common/gomp/declare-variant-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/declare-variant-2.c
@@ -149,7 +149,8 @@ void f72 (void);
 void f73 (void);
 #pragma omp declare variant (f1) match(construct={requires})	/* { dg-error "selector 'requires' not allowed for context selector set 'construct'" } */
 void f74 (void);
-#pragma omp declare variant (f1),match(construct={parallel})	/* { dg-error "expected 'match' before ','" } */
+void f75a (void);
+#pragma omp declare variant (f75a),match(construct={parallel})
 void f75 (void);
 #pragma omp declare variant (f1) match(implementation={atomic_default_mem_order("relaxed")})	/* { dg-error "expected identifier before string constant" } */
 void f76 (void);
diff --git a/gcc/testsuite/c-c++-common/gomp/directive-1.c b/gcc/testsuite/c-c++-common/gomp/directive-1.c
new file mode 100644
index 00000000000..e1218bd6869
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/directive-1.c
@@ -0,0 +1,28 @@
+int thr;
+#pragma omp threadprivate, (thr)		/* { dg-error "expected '\\\(' before ',' token" } */
+						/* { dg-error "expected end of line before ',' token" "" { target c++ } .-1 } */
+#pragma omp declare reduction, (foo: int : omp_out += omp_in), initializer (omp_priv = 0)	/* { dg-error "expected '\\\(' before ',' token" } */
+void f1 (void);
+#pragma omp declare variant, (f1), match (user={condition(true)})	/* { dg-error "expected '\\\(' before ',' token" } */
+void f2 (void);
+int j;
+#pragma omp declare target, (j)			/* { dg-error "expected end of line before ',' token" } */
+
+typedef struct __attribute__((__aligned__ (sizeof (void *)))) omp_depend_t {
+  char __omp_depend_t__[2 * sizeof (void *)];
+} omp_depend_t;
+extern omp_depend_t d;
+
+void
+foo (void)
+{
+  int i, k = 0, l = 0;
+  #pragma omp allocate, (i)			/* { dg-error "expected '\\\(' before ',' token" } */
+						/* { dg-error "expected end of line before ',' token" "" { target c++ } .-1 } */
+						/* { dg-message "not yet supported" "" { target *-*-* } .-2 } */
+  #pragma omp critical, (bar)			/* { dg-error "expected '#pragma omp' clause before '\\\(' token" } */
+  ;
+  #pragma omp flush, (k, l)			/* { dg-error "expected '\\\(' or end of line before ',' token" "" { target c } } */
+						/* { dg-error "expected end of line before ',' token" "" { target c++ } .-1 } */
+  #pragma omp depobj, (d) depend(in : l)	/* { dg-error "expected '\\\(' before ',' token" } */
+}
diff --git a/gcc/testsuite/g++.dg/gomp/clause-4.C b/gcc/testsuite/g++.dg/gomp/clause-4.C
index 06b91e8a28d..db191e2b689 100644
--- a/gcc/testsuite/g++.dg/gomp/clause-4.C
+++ b/gcc/testsuite/g++.dg/gomp/clause-4.C
@@ -14,7 +14,7 @@ foo (int x)
     ;
 #pragma omp p num_threads(4),if(1),private(x)
     ;
-#pragma omp p, num_threads (4), if (1), private (x)	// { dg-error "clause before" }
+#pragma omp p, num_threads (4), if (1), private (x)
     ;
 #pragma omp p num_threads (4), if (1), private (x),	// { dg-error "clause before" }
     ;
diff --git a/gcc/testsuite/gcc.dg/gomp/clause-2.c b/gcc/testsuite/gcc.dg/gomp/clause-2.c
index 4b12fc8f0c0..4d37c41cc9f 100644
--- a/gcc/testsuite/gcc.dg/gomp/clause-2.c
+++ b/gcc/testsuite/gcc.dg/gomp/clause-2.c
@@ -14,7 +14,7 @@ foo (int x)
     ;
 #pragma omp p num_threads(4),if(1),private(x)
     ;
-#pragma omp p, num_threads (4), if (1), private (x)	/* { dg-error "clause before" } */
+#pragma omp p, num_threads (4), if (1), private (x)
     ;
 #pragma omp p num_threads (4), if (1), private (x),	/* { dg-error "clause before" } */
     ;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-28  9:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-28  9:08 [gcc r13-3543] openmp: Allow optional comma after directive-specifier in C/C++ Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).