Hi Kwok, Tobias! On 2019-07-29T21:55:52+0100, Kwok Cheung Yeung <k...@codesourcery.com> wrote: > > if (omp_is_reference (new_var) > > && TREE_CODE (TREE_TYPE (new_var)) != POINTER_TYPE) > > As is, this code in lower_omp_target will always reject optional arguments, > so > it must be changed. This was introduced in commit r261025 (SVN trunk) as a > fix > for PR 85879, but it also breaks support for arrays in firstprivate, which > was > probably an unintended side-effect.
Do we have sufficient testsuite coverage for "arrays in firstprivate", in all languages? Grüße Thomas > I have found that allowing POINTER_TYPEs > that are also DECL_BY_REFERENCE through in this condition allows both > optional > arguments and arrays to work without regressing the tests in r261025. > * omp-low.c (lower_omp_target): Create temporary for received value > and take the address for new_var if the original variable was a > DECL_BY_REFERENCE. [...] > --- a/gcc/omp-low.c > +++ b/gcc/omp-low.c > @@ -11173,7 +11173,8 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, > omp_context *ctx) > { > gcc_assert (is_gimple_omp_oacc (ctx->stmt)); > if (omp_is_reference (new_var) > - && TREE_CODE (TREE_TYPE (new_var)) != POINTER_TYPE) > + && (TREE_CODE (TREE_TYPE (new_var)) != POINTER_TYPE > + || DECL_BY_REFERENCE (var))) > { > /* Create a local object to hold the instance > value. */ Grüße Thomas
signature.asc
Description: PGP signature