Hi!

We need OMP_CLAUSE_SHARED even for global vars if they are mapped
in an outer target region, because then the parallel region can't
access the global, but has to go through the mapping.

Testcase already in the testsuite (but failed only with non-shared
address space obviously).

Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk
and 4.9.

2014-08-15  Jakub Jelinek  <ja...@redhat.com>

        PR middle-end/62092
        * gimplify.c (gimplify_adjust_omp_clauses_1): Don't remove
        OMP_CLAUSE_SHARED for global vars if the global var is mentioned
        in OMP_CLAUSE_MAP in some outer target region.

--- gcc/gimplify.c.jj   2014-08-12 15:43:07.000000000 +0200
+++ gcc/gimplify.c      2014-08-14 13:39:22.263181286 +0200
@@ -6308,7 +6308,7 @@ gimplify_adjust_omp_clauses_1 (splay_tre
                = splay_tree_lookup (ctx->variables, (splay_tree_key) decl);
              if (on && (on->value & (GOVD_FIRSTPRIVATE | GOVD_LASTPRIVATE
                                      | GOVD_PRIVATE | GOVD_REDUCTION
-                                     | GOVD_LINEAR)) != 0)
+                                     | GOVD_LINEAR | GOVD_MAP)) != 0)
                break;
              ctx = ctx->outer_context;
            }

        Jakub

Reply via email to