diff mbox

[committed] Fix handling of shared(global_var) on omp parallel inside target region (PR middle-end/62092)

Message ID 20140815074538.GL1784@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Aug. 15, 2014, 7:45 a.m. UTC
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  <jakub@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.


	Jakub
diff mbox

Patch

--- 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;
 	    }