public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <Tom_deVries@mentor.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PING][PATCH] Remove incorrect warning for kernels copy clause
Date: Fri, 08 Apr 2016 08:54:00 -0000	[thread overview]
Message-ID: <57077197.4060405@mentor.com> (raw)
In-Reply-To: <5703907A.4010202@mentor.com>

[-- Attachment #1: Type: text/plain, Size: 1068 bytes --]

On 05/04/16 12:16, Tom de Vries wrote:
> On 24/03/16 17:59, Tom de Vries wrote:
>> Hi,
>>
>> This patch fixes an incorrect warning for the oacc copy clause.
>>
>> Consider this test-case:
>> ...
>> void
>> foo (void)
>> {
>>    int i;
>>
>> #pragma acc kernels
>>    {
>>      i = 1;
>>    }
>> }
>> ...
>>
>>
>> When compiling with -fopenacc -Wuninitialized, we get an 'is used
>> uninitialized' warning for variable 'i', which is confusing given that
>> 'i' is not used, but only set in the kernels region.
>>
>> The warning occurs because there's an implicit copy(i) clause on the
>> kernels region, and that copy generates a read of i before the region,
>> and a write to i in region.
>>
>> The patch silences the warning by marking the variable in the copy
>> clause with TREE_NO_WARNING.
>>
>> Build and reg-tested with goacc.exp, gomp.exp and target-libgomp.
>>
>> OK for trunk if bootstrap and reg-test succeeds?
>>
>
> Ping.
>

Committed as attached, with only the testcases. The code change has been 
committed as part of the fix for PR70550.

Thanks,
- TOm

[-- Attachment #2: 0001-Add-goacc-uninit-copy-clause.-c-f95-testcases.patch --]
[-- Type: text/x-patch, Size: 1675 bytes --]

Add goacc/uninit-copy-clause.{c,f95} testcases

2016-03-24  Tom de Vries  <tom@codesourcery.com>

	* c-c++-common/goacc/uninit-copy-clause.c: New test.
	* gfortran.dg/goacc/uninit-copy-clause.f95: New test.

---
 .../c-c++-common/goacc/uninit-copy-clause.c        | 38 ++++++++++++++++++++++
 .../gfortran.dg/goacc/uninit-copy-clause.f95       | 29 +++++++++++++++++
 2 files changed, 67 insertions(+)

diff --git a/gcc/testsuite/c-c++-common/goacc/uninit-copy-clause.c b/gcc/testsuite/c-c++-common/goacc/uninit-copy-clause.c
new file mode 100644
index 0000000..b3cc445
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/uninit-copy-clause.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Wuninitialized" } */
+
+void
+foo (void)
+{
+  int i;
+
+#pragma acc kernels
+  {
+    i = 1;
+  }
+
+}
+
+void
+foo2 (void)
+{
+  int i;
+
+#pragma acc kernels copy (i)
+  {
+    i = 1;
+  }
+
+}
+
+void
+foo3 (void)
+{
+  int i;
+
+#pragma acc kernels copyin(i)
+  {
+    i = 1;
+  }
+
+}
diff --git a/gcc/testsuite/gfortran.dg/goacc/uninit-copy-clause.f95 b/gcc/testsuite/gfortran.dg/goacc/uninit-copy-clause.f95
new file mode 100644
index 0000000..b2aae1d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/uninit-copy-clause.f95
@@ -0,0 +1,29 @@
+! { dg-do compile }
+! { dg-additional-options "-Wuninitialized" }
+
+subroutine foo
+  integer :: i
+
+  !$acc kernels
+  i = 1
+  !$acc end kernels
+
+end subroutine foo
+
+subroutine foo2
+  integer :: i
+
+  !$acc kernels copy (i)
+  i = 1
+  !$acc end kernels
+
+end subroutine foo2
+
+subroutine foo3
+  integer :: i
+
+  !$acc kernels copyin (i)
+  i = 1
+  !$acc end kernels
+
+end subroutine foo3

      reply	other threads:[~2016-04-08  8:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-24 17:03 [PATCH] " Tom de Vries
2016-04-05 10:16 ` [PING][PATCH] " Tom de Vries
2016-04-08  8:54   ` Tom de Vries [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57077197.4060405@mentor.com \
    --to=tom_devries@mentor.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).