diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-09-02 18:38:07 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-09-02 18:38:07 +0000 |
commit | 0b80c4b2d7a168c3da186901ff8f4b9b53eaab4a (patch) | |
tree | 4e53b18a2fda99a485292dfd9bf30c8fbd9145b7 /gcc/gimplify.c | |
parent | fe066ce3d8b45a687ddb9ebba6426a3746f3a8ca (diff) | |
download | gcc-0b80c4b2d7a168c3da186901ff8f4b9b53eaab4a.tar.gz |
PR c/65467
* gimplify.c (gimplify_adjust_omp_clauses_1): Diagnose implicit
map and firstprivate clauses on target construct for _Atomic
qualified decls.
(gimplify_adjust_omp_clauses): Diagnose explicit firstprivate clauses
on target construct for _Atomic qualified decls.
* omp-low.c (use_pointer_for_field): Return true for _Atomic qualified
decls.
* omp-simd-clone.c (simd_clone_clauses_extract): Warn and give up for
_Atomic qualified arguments not mentioned in uniform clause.
c/
* c-parser.c (c_parser_declspecs): Don't sorry about _Atomic if
flag_openmp.
(c_parser_omp_variable_list): Use convert_lvalue_to_rvalue
instead of mark_exp_read on low_bound/length expression.
(c_parser_omp_clause_num_gangs, c_parser_omp_clause_num_threads,
c_parser_omp_clause_num_tasks, c_parser_omp_clause_grainsize,
c_parser_omp_clause_priority, c_parser_omp_clause_hint,
c_parser_omp_clause_num_workers, c_parser_oacc_shape_clause,
c_parser_oacc_clause_tile, c_parser_omp_clause_schedule,
c_parser_omp_clause_vector_length, c_parser_omp_clause_num_teams,
c_parser_omp_clause_thread_limit, c_parser_omp_clause_aligned,
c_parser_omp_clause_linear, c_parser_omp_clause_safelen,
c_parser_omp_clause_simdlen, c_parser_omp_clause_device,
c_parser_omp_clause_dist_schedule): Use convert_lvalue_to_rvalue
instead of mark_expr_read.
(c_parser_omp_declare_reduction): Reject _Atomic qualified types.
* c-objc-common.h (LANG_HOOKS_OMP_CLAUSE_COPY_CTOR,
LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP): Redefine.
* c-tree.h (c_omp_clause_copy_ctor): New prototype.
* c-typeck.c (handle_omp_array_sections_1): Diagnose _Atomic qualified
array section bases outside of depend clause, for depend clause
use convert_lvalue_to_rvalue on the base.
(c_finish_omp_clauses): Reject _Atomic qualified vars in reduction,
linear, aligned, map, to and from clauses.
(c_omp_clause_copy_ctor): New function.
c-family/
* c-omp.c (c_finish_omp_atomic): Reject _Atomic qualified expressions.
(c_finish_omp_for): Reject _Atomic qualified iterators.
testsuite/
* gcc.dg/gomp/_Atomic-1.c: New test.
* gcc.dg/gomp/_Atomic-2.c: New test.
* gcc.dg/gomp/_Atomic-3.c: New test.
* gcc.dg/gomp/_Atomic-4.c: New test.
* gcc.dg/gomp/_Atomic-5.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239964 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 21e1c093385..2f0dd88ebd6 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -7911,7 +7911,15 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data) if (private_debug) code = OMP_CLAUSE_PRIVATE; else if (flags & GOVD_MAP) - code = OMP_CLAUSE_MAP; + { + code = OMP_CLAUSE_MAP; + if ((gimplify_omp_ctxp->region_type & ORT_ACC) == 0 + && TYPE_ATOMIC (strip_array_types (TREE_TYPE (decl)))) + { + error ("%<_Atomic%> %qD in implicit %<map%> clause", decl); + return 0; + } + } else if (flags & GOVD_SHARED) { if (is_global_var (decl)) @@ -7935,7 +7943,17 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data) else if (flags & GOVD_PRIVATE) code = OMP_CLAUSE_PRIVATE; else if (flags & GOVD_FIRSTPRIVATE) - code = OMP_CLAUSE_FIRSTPRIVATE; + { + code = OMP_CLAUSE_FIRSTPRIVATE; + if ((gimplify_omp_ctxp->region_type & ORT_TARGET) + && (gimplify_omp_ctxp->region_type & ORT_ACC) == 0 + && TYPE_ATOMIC (strip_array_types (TREE_TYPE (decl)))) + { + error ("%<_Atomic%> %qD in implicit %<firstprivate%> clause on " + "%<target%> construct", decl); + return 0; + } + } else if (flags & GOVD_LASTPRIVATE) code = OMP_CLAUSE_LASTPRIVATE; else if (flags & GOVD_ALIGNED) @@ -8090,9 +8108,21 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, gimple_seq body, tree *list_p, switch (OMP_CLAUSE_CODE (c)) { + case OMP_CLAUSE_FIRSTPRIVATE: + if ((ctx->region_type & ORT_TARGET) + && (ctx->region_type & ORT_ACC) == 0 + && TYPE_ATOMIC (strip_array_types + (TREE_TYPE (OMP_CLAUSE_DECL (c))))) + { + error_at (OMP_CLAUSE_LOCATION (c), + "%<_Atomic%> %qD in %<firstprivate%> clause on " + "%<target%> construct", OMP_CLAUSE_DECL (c)); + remove = true; + break; + } + /* FALLTHRU */ case OMP_CLAUSE_PRIVATE: case OMP_CLAUSE_SHARED: - case OMP_CLAUSE_FIRSTPRIVATE: case OMP_CLAUSE_LINEAR: decl = OMP_CLAUSE_DECL (c); n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl); |