From patchwork Fri Apr 8 08:53:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 607932 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qhCtx5s0zz9t3Z for ; Fri, 8 Apr 2016 18:54:17 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=F/AOsZtH; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=MQRcBk14ofQ7VwNxX +wLgJOVWOKLbT+xrMiAGdTLxgWxfwAa5PfkVjH4e/BzVLAEhF/ZyYyvQnjQII9Cj pebr4+Qs0OzMMQ8lkDWzv7Hu6x124YoBIdD8X5pHKSm6t76a1XmL7TYrilIVjpyN /9eHl58iMQAuTxcYrb6JL+d+sM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=Bz9t7Jwq3egx3ivv+tQEZsF HY4Q=; b=F/AOsZtHOOva8cFSZSTJzk17Alema5bqc0aPgST3MwLAj5NaZABJCch vuP+BKwf1xMae0u4w1LLdpcpfaN3E13yLt7kUyr3oh4bBWpo8YV8q8wd0lJtyhKr CD2/igy8UySPrH5x92x0IFarBRe5r7P62t0sbnMlnXcW5Q4mClY8= Received: (qmail 40982 invoked by alias); 8 Apr 2016 08:54:09 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 40969 invoked by uid 89); 8 Apr 2016 08:54:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS, UNSUBSCRIBE_BODY, URIBL_RED autolearn=no version=3.3.2 spammy= X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 08 Apr 2016 08:53:58 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1aoSAt-0000kb-9m from Tom_deVries@mentor.com ; Fri, 08 Apr 2016 01:53:55 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Fri, 8 Apr 2016 09:53:53 +0100 Subject: Re: [PING][PATCH] Remove incorrect warning for kernels copy clause To: Jakub Jelinek References: <56F41D05.7040700@mentor.com> <5703907A.4010202@mentor.com> CC: GCC Patches From: Tom de Vries Message-ID: <57077197.4060405@mentor.com> Date: Fri, 8 Apr 2016 10:53:43 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <5703907A.4010202@mentor.com> 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 Add goacc/uninit-copy-clause.{c,f95} testcases 2016-03-24 Tom de Vries * 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