https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68733
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |rth at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Has OpenMP ever worked on PA? The OpenMP gimplification is unprepared to see the result of gimplify_parameters if reference_callee_copied is true on some parameter. But it is far from just the target construct, for which I've tried something like: --- gimplify.c.jj 2015-12-04 17:19:12.000000000 +0100 +++ gimplify.c 2015-12-10 18:02:03.224659575 +0100 @@ -6836,6 +6836,18 @@ gimplify_scan_omp_clauses (tree *list_p, machine_mode mode; int unsignedp, reversep, volatilep = 0; tree base = OMP_CLAUSE_DECL (c); + /* Undo DECL_VALUE_EXPR expansion of the base. */ + if (DECL_HAS_VALUE_EXPR_P (decl)) + { + tree *p = &OMP_CLAUSE_DECL (c); + while (TREE_CODE (*p) == ARRAY_REF) + p = &TREE_OPERAND (*p, 0); + if (TREE_CODE (*p) == INDIRECT_REF) + p = &TREE_OPERAND (*p, 0); + while (handled_component_p (*p)) + p = &TREE_OPERAND (*p, 0); + *p = decl; + } while (TREE_CODE (base) == ARRAY_REF) base = TREE_OPERAND (base, 0); if (TREE_CODE (base) == INDIRECT_REF) I probably can't just disable DECL_HAS_VALUE_EXPR_P temporarily, because if there is say map(tofrom:s.d[s.i + 1:s.j - 2]) then we want to expand s.i and s.j into s.0.i and s.1.j. But, looking at trivial testcase like: struct S { char p[64]; int a; int b[2]; long c[4]; int *d; char q[64]; }; __attribute__((noinline, noclone)) void foo (struct S s) { #pragma omp parallel private (s) { s.a = 5; s.b[0] = 6; } } I see __attribute__((noclone, noinline)) foo (struct S s) { struct S s.0; s.0 = s; #pragma omp parallel private(s) shared(s.0) { s.0.a = 5; s.0.b[0] = 6; } } in gimple dump, which means that user said the var should be privatized, but in reality the other var is used and is shared, so PA must be full of data races in OpenMP code. Not sure what exactly to do here though, supposedly we want to arrange for such callee copies parameters to disregard value exprs in the bodies of OpenMP constructs, but not sure how to reliably detect those PARM_DECLs. Richard, any thoughts on this?