This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PING][PATCH] Remove incorrect warning for parallel firstprivate clause
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Tom de Vries <Tom_deVries at mentor dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 8 Apr 2016 11:35:45 +0200
- Subject: Re: [PING][PATCH] Remove incorrect warning for parallel firstprivate clause
- Authentication-results: sourceware.org; auth=none
- References: <56F41DB9 dot 5000100 at mentor dot com> <570390AC dot 9000402 at mentor dot com> <20160405154435 dot GP19207 at tucnak dot redhat dot com> <57077AB2 dot 6000808 at mentor dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Apr 08, 2016 at 11:32:34AM +0200, Tom de Vries wrote:
> Patch updated as attached.
>
> OK for stage4/stage1 trunk?
Ok for stage4, thanks.
> Remove incorrect warning for parallel implicit firstprivate clause
>
> 2016-03-24 Tom de Vries <tom@codesourcery.com>
>
> * omp-low.c (lower_omp_target): Set TREE_NO_WARNING for oacc
> implicit 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 | 7 +++++-
> .../goacc/uninit-firstprivate-clause.c | 25 ++++++++++++++++++++++
> .../goacc/uninit-firstprivate-clause.f95 | 18 ++++++++++++++++
> 3 files changed, 49 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/omp-low.c b/gcc/omp-low.c
> index 979926d..7105194 100644
> --- a/gcc/omp-low.c
> +++ b/gcc/omp-low.c
> @@ -16077,7 +16077,12 @@ 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);
> + {
> + if (is_gimple_reg (var)
> + && OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c))
> + TREE_NO_WARNING (var) = 1;
> + var = build_fold_addr_expr (var);
> + }
> else
> talign = TYPE_ALIGN_UNIT (TREE_TYPE (TREE_TYPE (ovar)));
> gimplify_assign (x, var, &ilist);
> diff --git a/gcc/testsuite/c-c++-common/goacc/uninit-firstprivate-clause.c b/gcc/testsuite/c-c++-common/goacc/uninit-firstprivate-clause.c
> new file mode 100644
> index 0000000..2584033
> --- /dev/null
> +++ b/gcc/testsuite/c-c++-common/goacc/uninit-firstprivate-clause.c
> @@ -0,0 +1,25 @@
> +/* { dg-do compile } */
> +/* { dg-additional-options "-Wuninitialized" } */
> +
> +void
> +foo (void)
> +{
> + int i;
> +
> +#pragma acc parallel
> + {
> + i = 1;
> + }
> +}
> +
> +
> +void
> +foo2 (void)
> +{
> + int i;
> +
> +#pragma acc parallel firstprivate (i) /* { dg-warning "is used uninitialized in this function" } */
> + {
> + i = 1;
> + }
> +}
> diff --git a/gcc/testsuite/gfortran.dg/goacc/uninit-firstprivate-clause.f95 b/gcc/testsuite/gfortran.dg/goacc/uninit-firstprivate-clause.f95
> new file mode 100644
> index 0000000..14d960a
> --- /dev/null
> +++ b/gcc/testsuite/gfortran.dg/goacc/uninit-firstprivate-clause.f95
> @@ -0,0 +1,18 @@
> +! { dg-do compile }
> +! { dg-additional-options "-Wuninitialized" }
> +
> +subroutine test
> + INTEGER :: i
> +
> + !$acc parallel
> + i = 1
> + !$acc end parallel
> +end subroutine test
> +
> +subroutine test2
> + INTEGER :: i
> +
> + !$acc parallel firstprivate (i) ! { dg-warning "is used uninitialized in this function" }
> + i = 1
> + !$acc end parallel
> +end subroutine test2
Jakub