On Tue, Apr 05, 2016 at 12:17:16PM +0200, Tom de Vries wrote:
> On 24/03/16 18:02, Tom de Vries wrote:
> >Remove incorrect warning for parallel firstprivate clause
> >
> >2016-03-24  Tom de Vries  <t...@codesourcery.com>
> >
> >     * omp-low.c (lower_omp_target): Set TREE_NO_WARNING for oacc
> >     firstprivate clause.
> >
> >     * c-c++-common/goacc/uninit-firstprivate-clause.c: New test.
> >     * gfortran.dg/goacc/uninit-firstprivate-clause.f95: New test.
> >
> >---
> >  gcc/omp-low.c                                      |  5 ++++-
> >  .../goacc/uninit-firstprivate-clause.c             | 25 
> > ++++++++++++++++++++++
> >  .../goacc/uninit-firstprivate-clause.f95           | 18 ++++++++++++++++
> >  3 files changed, 47 insertions(+), 1 deletion(-)
> >
> >diff --git a/gcc/omp-low.c b/gcc/omp-low.c
> >index d107961..41eb3c8 100644
> >--- a/gcc/omp-low.c
> >+++ b/gcc/omp-low.c
> >@@ -16068,7 +16068,10 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, 
> >omp_context *ctx)
> >               {
> >                 gcc_assert (is_gimple_omp_oacc (ctx->stmt));
> >                 if (!is_reference (var))
> >-                  var = build_fold_addr_expr (var);
> >+                  {
> >+                    TREE_NO_WARNING (var) = 1;
> >+                    var = build_fold_addr_expr (var);
> >+                  }

IMHO it should be done only if var is is_gimple_reg (var), otherwise all
that happens on the caller side is that you take the address of the actual
variable.  Also, I think it would be better to do this only
for implicit firstprivate (and map) clauses, if somebody uses explicit
firstprivate on a var, I think it is better to warn if the var is
uninitialized, the user can then use private clause instead.

BTW, some undesirable warnings are also on OpenMP code (I'm adding
TREE_NO_WARNING already in case of shared clause), I've filed PR70550
to track this and will attach there a patch soon.

        Jakub

Reply via email to