diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-06-12 21:10:11 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-06-12 21:10:11 +0000 |
commit | 5fddcf345b6badb03bd9a4ece4db58454738cb83 (patch) | |
tree | c4172ecef31a5a6826c56350eb72c44c9d78516b /gcc/omp-low.c | |
parent | 74b777e5d18c4e568728c4aeb9966928bcb182bb (diff) | |
download | gcc-5fddcf345b6badb03bd9a4ece4db58454738cb83.tar.gz |
PR middle-end/61486
* gimplify.c (struct gimplify_omp_ctx): Add distribute field.
(gimplify_adjust_omp_clauses): Don't or in GOVD_LASTPRIVATE
if outer combined construct is distribute.
(gimplify_omp_for): For OMP_DISTRIBUTE set
gimplify_omp_ctxp->distribute.
* omp-low.c (scan_sharing_clauses) <case OMP_CLAUSE_SHARED>: For
GIMPLE_OMP_TEAMS, if decl isn't global in outer context, record
mapping into decl map.
c-family/
* c-omp.c (c_omp_split_clauses): Don't crash on firstprivate in
#pragma omp target teams or
#pragma omp {,target }teams distribute simd.
testsuite/
* c-c++-common/gomp/pr61486-1.c: New test.
* c-c++-common/gomp/pr61486-2.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211596 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r-- | gcc/omp-low.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c index ddb049d3ea1..67254cc5bdf 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -1509,11 +1509,19 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) break; case OMP_CLAUSE_SHARED: + decl = OMP_CLAUSE_DECL (c); /* Ignore shared directives in teams construct. */ if (gimple_code (ctx->stmt) == GIMPLE_OMP_TEAMS) - break; + { + /* Global variables don't need to be copied, + the receiver side will use them directly. */ + tree odecl = maybe_lookup_decl_in_outer_ctx (decl, ctx); + if (is_global_var (odecl)) + break; + insert_decl_map (&ctx->cb, decl, odecl); + break; + } gcc_assert (is_taskreg_ctx (ctx)); - decl = OMP_CLAUSE_DECL (c); gcc_assert (!COMPLETE_TYPE_P (TREE_TYPE (decl)) || !is_variable_sized (decl)); /* Global variables don't need to be copied, |