From patchwork Thu Mar 24 12:11:21 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: 601559 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 3qW4zt0tNLz9sCy for ; Thu, 24 Mar 2016 23:11:53 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=OqGpqmKq; 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:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=I1i5K88NwaoKysBbqQ+nbKpKTJ5MlHjpK8E4Mzr5vVqsZd4Bzk fG9ApsBRW1BeinMUmEJvdZa8hzEY/LV2GspZY++zq35BT7Gdhqkieby8D/42iis9 KnpifZxKaHD/yazK8b2t+KKGCpOfb4pd6hcUFdwY0OUSeOLTKumm0uPJQ= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=3VvDgQ8Pl3h+O1GDtAJqtGq8h7Y=; b=OqGpqmKqvbwjOEMVV9yn Ecfu6X3QGibnQNklh4zaJktXgb4u/fjOYzA+1hdYjJfEOLds8EoRiE9jEgFIfwv4 L0r23m9Mwzm1Ccc2XJwZkGbt5XHwPnKJRkH/YeNt4TGwacADt1MdHdwLWba5bYFK Ri3c0Bxz7lXvqSvoWf/sSPk= Received: (qmail 44515 invoked by alias); 24 Mar 2016 12:11:44 -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 44494 invoked by uid 89); 24 Mar 2016 12:11:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=scans, 1, 20 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; Thu, 24 Mar 2016 12:11:33 +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 1aj46s-00027R-7s from Tom_deVries@mentor.com ; Thu, 24 Mar 2016 05:11:30 -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; Thu, 24 Mar 2016 12:11:28 +0000 To: GCC Patches CC: Thomas Schwinge , Jakub Jelinek From: Tom de Vries Subject: [testsuite, committed] Add goacc/uninit-if-clause.{c,f95} Message-ID: <56F3D969.4060009@mentor.com> Date: Thu, 24 Mar 2016 13:11:21 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 Hi, I've committed attached patch, which adds testcases that test the -Wuninitialized warning for the if clause on various openacc directives. I found an issue with line-numbers of the warning in C++, which I've filed as PR70392 - '[openacc] inconsistent line numbers in uninitialised warnings for if clause'. Some of the warning scans are xfailed in C++ due to that PR. Thanks, - Tom Add goacc/uninit-if-clause.{c,f95} 2016-03-24 Tom de Vries * c-c++-common/goacc/uninit-if-clause.c: New test. * gfortran.dg/goacc/uninit-if-clause.f95: New test. --- .../c-c++-common/goacc/uninit-if-clause.c | 38 ++++++++++++++++++++++ .../gfortran.dg/goacc/uninit-if-clause.f95 | 20 ++++++++++++ 2 files changed, 58 insertions(+) diff --git a/gcc/testsuite/c-c++-common/goacc/uninit-if-clause.c b/gcc/testsuite/c-c++-common/goacc/uninit-if-clause.c new file mode 100644 index 0000000..55caa4c --- /dev/null +++ b/gcc/testsuite/c-c++-common/goacc/uninit-if-clause.c @@ -0,0 +1,38 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-Wuninitialized" } */ +/* { dg-excess-errors "PR70392" { xfail c++ } } */ + +#include + +int +main (void) +{ + int l, l2, l3, l4; + bool b, b2, b3, b4; + int i, i2; + + #pragma acc parallel if(l) /* { dg-warning "is used uninitialized in this function" } */ + ; + + #pragma acc parallel if(b) /* { dg-warning "is used uninitialized in this function" "" { xfail c++ } } */ + ; + + #pragma acc kernels if(l2) /* { dg-warning "is used uninitialized in this function" } */ + ; + + #pragma acc kernels if(b2) /* { dg-warning "is used uninitialized in this function" "" { xfail c++ } } */ + ; + + #pragma acc data if(l3) /* { dg-warning "is used uninitialized in this function" } */ + ; + + #pragma acc data if(b3) /* { dg-warning "is used uninitialized in this function" "" { xfail c++ } } */ + ; + + #pragma acc update if(l4) self(i) /* { dg-warning "is used uninitialized in this function" } */ + ; + + #pragma acc update if(b4) self(i2) /* { dg-warning "is used uninitialized in this function" "" { xfail c++ } } */ + ; + +} diff --git a/gcc/testsuite/gfortran.dg/goacc/uninit-if-clause.f95 b/gcc/testsuite/gfortran.dg/goacc/uninit-if-clause.f95 new file mode 100644 index 0000000..60dc53e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/uninit-if-clause.f95 @@ -0,0 +1,20 @@ +! { dg-do compile } +! { dg-additional-options "-Wuninitialized" } + +program test + implicit none + logical :: b, b2, b3, b4 + integer :: data, data2 + + !$acc parallel if(b) ! { dg-warning "is used uninitialized in this function" } + !$acc end parallel + + !$acc kernels if(b2) ! { dg-warning "is used uninitialized in this function" } + !$acc end kernels + + !$acc data if(b3) ! { dg-warning "is used uninitialized in this function" } + !$acc end data + + !$acc update if(b4) self(data2) ! { dg-warning "is used uninitialized in this function" } + +end program test