This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gomp4] Small OpenMP 4.0 post-RC2 tweaks
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 12 Jun 2013 15:08:57 +0200
- Subject: [gomp4] Small OpenMP 4.0 post-RC2 tweaks
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
1) reference types in map/to/from clauses are supposed to map/copy what
those references refer to, so the reference var itself doesn't need to be
addressable. We'll need to remap the reference variable to a new reference
that will refer to the corresponding device object.
2) the spec now allows more than one to/from clauses, and the clauses don't
need to be first, restriction is that there must be at least one to/from
clause on #pragma omp target update
3) [ expression ] syntax is now freely interchangeable with
[ expression[opt] : expression[opt] ] syntax, a[3] in the clauses is
considered array element, while a[:][3][1:8] array section, but as both
array elements and array sections are allowed at the same spots, it is
easiest to parse [ expression ] the same as [ expression : 1 ].
More tweaks to follow.
2013-06-12 Jakub Jelinek <jakub@redhat.com>
* semantics.c (finish_omp_clause): Don't mark references addressable.
For OMP_CLAUSE_{TO,FROM} detect same decl appearing more than once
in motion clauses.
* parser.c (cp_parser_omp_var_list_no_open): Handle [ expression ]
notation in array section specification.
(cp_parser_omp_all_clauses): Don't require to/from clauses to be
first.
(cp_parser_omp_target_update): Adjust diagnostics.
--- gcc/cp/semantics.c.jj 2013-06-04 20:55:56.000000000 +0200
+++ gcc/cp/semantics.c 2013-06-12 14:46:18.251419189 +0200
@@ -4925,8 +4944,18 @@ finish_omp_clauses (tree clauses)
remove = true;
}
else if (!processing_template_decl
+ && TREE_CODE (TREE_TYPE (t)) != REFERENCE_TYPE
&& !cxx_mark_addressable (t))
remove = true;
+ else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP)
+ break;
+ else if (bitmap_bit_p (&generic_head, DECL_UID (t)))
+ {
+ error ("%qD appears more than once in motion clauses", t);
+ remove = true;
+ }
+ else
+ bitmap_set_bit (&generic_head, DECL_UID (t));
break;
case OMP_CLAUSE_UNIFORM:
--- gcc/cp/parser.c.jj 2013-06-04 20:55:56.000000000 +0200
+++ gcc/cp/parser.c 2013-06-12 12:22:01.239604269 +0200
@@ -26330,13 +26332,19 @@ cp_parser_omp_var_list_no_open (cp_parse
if (!colon)
parser->colon_corrects_to_scope_p
= saved_colon_corrects_to_scope_p;
- /* Look for `:'. */
- if (!cp_parser_require (parser, CPP_COLON, RT_COLON))
- goto skip_comma;
- if (!cp_lexer_next_token_is (parser->lexer,
- CPP_CLOSE_SQUARE))
- length = cp_parser_expression (parser, /*cast_p=*/false,
- NULL);
+ if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_SQUARE))
+ length = integer_one_node;
+ else
+ {
+ /* Look for `:'. */
+ if (!cp_parser_require (parser, CPP_COLON, RT_COLON))
+ goto skip_comma;
+ if (!cp_lexer_next_token_is (parser->lexer,
+ CPP_CLOSE_SQUARE))
+ length = cp_parser_expression (parser,
+ /*cast_p=*/false,
+ NULL);
+ }
/* Look for the closing `]'. */
if (!cp_parser_require (parser, CPP_CLOSE_SQUARE,
RT_CLOSE_SQUARE))
@@ -27409,15 +27447,11 @@ cp_parser_omp_all_clauses (cp_parser *pa
clauses = cp_parser_omp_var_list (parser, OMP_CLAUSE_TO,
clauses);
c_name = "to";
- if (!first)
- goto clause_not_first;
break;
case PRAGMA_OMP_CLAUSE_FROM:
clauses = cp_parser_omp_var_list (parser, OMP_CLAUSE_FROM,
clauses);
c_name = "from";
- if (!first)
- goto clause_not_first;
break;
case PRAGMA_OMP_CLAUSE_UNIFORM:
clauses = cp_parser_omp_var_list (parser, OMP_CLAUSE_UNIFORM,
@@ -29128,7 +29167,7 @@ cp_parser_omp_target_update (cp_parser *
&& find_omp_clause (clauses, OMP_CLAUSE_FROM) == NULL_TREE)
{
error_at (pragma_tok->location,
- "%<#pragma omp target update must contain either "
+ "%<#pragma omp target update must contain at least one "
"%<from%> or %<to%> clauses");
return false;
}
Jakub