Jakub, The attached patch and ChangeLog reflect the updates from your review: https://gcc.gnu.org/ml/gcc-patches/2015-11/msg00703.html. The most significant change was the one that you suggestion: On 11/06/2015 02:28 PM, Jakub Jelinek wrote: > Perhaps what would work is stick the exit clauses you need for automatic > vars in the function inside of some pointer map / hash table / whatever, > and then in gimplify_bind_expr in the > /* Add clobbers for all variables that go out of scope. */ > if if flag_openacc && the pointer_map /hash table has any entries look > up each variable in there and collect the clauses from those vars that go > out of scope, after the loop if any were collected construct the statement > you need prepend it to cleanup (so that it works before restoring VLA memory > and before the clobber stmts). This particular change allowed for the removal of all the 'stuff looks broken' code. Thanks for the suggestion. The following change I did not address: On 11/06/2015 01:03 PM, Jakub Jelinek wrote >> @@ -5841,6 +5863,8 @@ omp_default_clause (struct gimplify_omp_ctx *ctx, tree decl, >> flags |= GOVD_FIRSTPRIVATE; >> break; >> case OMP_CLAUSE_DEFAULT_UNSPECIFIED: >> + if (is_global_var (decl) && device_resident_p (decl)) >> +flags |= GOVD_MAP_TO_ONLY | GOVD_MAP; > > I don't think you want to do this except for (selected or all?) > OpenACC contexts. Say, I don't see why one couldn't e.g. try to mix > OpenMP host parallelization or tasking with OpenACC offloading, > and that affecting in weird way OpenMP semantics. A colleague is adding code to allow for the detection of OpenACC contexts. This change has yet make it to trunk. I need some guidance from you whether I can leave the code as is and resolve the issue at stage3 time, or remove the code and the associated function device_resident_() and address the issue at stage 3. OK to commit to trunk? Thanks! Jim