From patchwork Fri Dec 12 20:04:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 420660 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 BC14B140082 for ; Sat, 13 Dec 2014 07:04:39 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; q=dns; s=default; b=DCRcy+QzFilqwKGl mNX3trL+oejennOBvqSXVE5cIHx4Frf/DW+aB+yVM2/pRT8XYjYKpOOeFH11y+4y KbBq8agnqiFe8UmrDa/TjnnARoinhkPfvyjBdNcjlwTSddk1pFDUeSgtfYonXH4I RrI7o2zH6G0TcaJc6L3Nkp9JX48= 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:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=default; bh=phPpW40LKm/zRQxyTL25kf jufr8=; b=LHnEO/c+Rx6Bc4/vwT8YKPJFxRkgXtIMphebyAs1FS1uSRhWMG96jg ZDGChsDUP0a4aw5h6HYYO+GvrVsiZkV5mKOM8Zhuwd9TvqAHTC4knyFXD4YsqU5w sIxJ4f8IPKPTJAQrFQhVtn3oy61/ejlOORHY65SVX+88oNi0XlIDw= Received: (qmail 14450 invoked by alias); 12 Dec 2014 20:04:32 -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 14440 invoked by uid 89); 12 Dec 2014 20:04:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 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 ESMTP; Fri, 12 Dec 2014 20:04:30 +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 1XzWRv-0004ev-BE from Thomas_Schwinge@mentor.com ; Fri, 12 Dec 2014 12:04:27 -0800 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.181.6; Fri, 12 Dec 2014 20:04:25 +0000 From: Thomas Schwinge To: Jakub Jelinek CC: Subject: Re: Nested OpenACC/OpenMP constructs In-Reply-To: <20141210101608.GA1667@tucnak.redhat.com> References: <1383766943-8863-5-git-send-email-thomas@codesourcery.com> <1383766943-8863-6-git-send-email-thomas@codesourcery.com> <1383766943-8863-7-git-send-email-thomas@codesourcery.com> <1383766943-8863-8-git-send-email-thomas@codesourcery.com> <1383766943-8863-9-git-send-email-thomas@codesourcery.com> <8761s5joir.fsf@schwinge.name> <87sihoczm0.fsf@kepler.schwinge.homeip.net> <20141112134502.GC5026@tucnak.redhat.com> <87sign7rgv.fsf@kepler.schwinge.homeip.net> <87iohj7r3o.fsf@kepler.schwinge.homeip.net> <20141210101608.GA1667@tucnak.redhat.com> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Fri, 12 Dec 2014 21:04:21 +0100 Message-ID: <87sigkws6y.fsf@schwinge.name> MIME-Version: 1.0 Hi! On Wed, 10 Dec 2014 11:16:08 +0100, Jakub Jelinek wrote: > On Wed, Dec 10, 2014 at 11:10:19AM +0100, Thomas Schwinge wrote: > > --- /dev/null > > +++ gcc/testsuite/c-c++-common/gomp/nesting-1.c > > @@ -0,0 +1,77 @@ > > +void > > +f_omp_parallel (void) > > +{ > > +#pragma omp parallel > > + { > > + int i; > > Can you please use a global variable declared outside of > f_omp_parallel instead? > > > + > > +#pragma omp parallel > > + ; > > + > > +#pragma omp target > > + ; > > + > > +#pragma omp target data > > + ; > > + > > +#pragma omp target update to(i) > > The thing is, if GCC tried harder, it could complain here, > because i can't really be mapped at this point and thus it would be always > undefined behavior. If the var is global, it is possible > somebody uses > #pragma omp target map(i) > f_omp_parallel (); > and then it would be valid. That makes sense, thanks. > Similarly in other tests. Will change on gomp-4_0-branch. > Otherwise LGTM. Committed to trunk in r218687: commit 4c37888fdc6548eba74aa0d652e37b33dd097aea Author: tschwinge Date: Fri Dec 12 20:01:29 2014 +0000 OpenMP target nesting tests. gcc/testsuite/ * c-c++-common/gomp/nesting-1.c: New file. * c-c++-common/gomp/nesting-warn-1.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218687 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 5 ++ gcc/testsuite/c-c++-common/gomp/nesting-1.c | 75 ++++++++++++++++++++++++ gcc/testsuite/c-c++-common/gomp/nesting-warn-1.c | 23 ++++++++ 3 files changed, 103 insertions(+) Grüße, Thomas diff --git gcc/testsuite/ChangeLog gcc/testsuite/ChangeLog index 8e5b424..f2502ff 100644 --- gcc/testsuite/ChangeLog +++ gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-12-12 Thomas Schwinge + + * c-c++-common/gomp/nesting-1.c: New file. + * c-c++-common/gomp/nesting-warn-1.c: Likewise. + 2014-12-12 Kai Tietz PR c++/63996 diff --git gcc/testsuite/c-c++-common/gomp/nesting-1.c gcc/testsuite/c-c++-common/gomp/nesting-1.c new file mode 100644 index 0000000..711ff8e --- /dev/null +++ gcc/testsuite/c-c++-common/gomp/nesting-1.c @@ -0,0 +1,75 @@ +extern int i; + +void +f_omp_parallel (void) +{ +#pragma omp parallel + { +#pragma omp parallel + ; + +#pragma omp target + ; + +#pragma omp target data + ; + +#pragma omp target update to(i) + +#pragma omp target data + { +#pragma omp parallel + ; + +#pragma omp target + ; + +#pragma omp target data + ; + +#pragma omp target update to(i) + } + } +} + +void +f_omp_target (void) +{ +#pragma omp target + { +#pragma omp parallel + ; + } +} + +void +f_omp_target_data (void) +{ +#pragma omp target data + { +#pragma omp parallel + ; + +#pragma omp target + ; + +#pragma omp target data + ; + +#pragma omp target update to(i) + +#pragma omp target data + { +#pragma omp parallel + ; + +#pragma omp target + ; + +#pragma omp target data + ; + +#pragma omp target update to(i) + } + } +} diff --git gcc/testsuite/c-c++-common/gomp/nesting-warn-1.c gcc/testsuite/c-c++-common/gomp/nesting-warn-1.c new file mode 100644 index 0000000..c39dd49 --- /dev/null +++ gcc/testsuite/c-c++-common/gomp/nesting-warn-1.c @@ -0,0 +1,23 @@ +extern int i; + +void +f_omp_target (void) +{ +#pragma omp target + { +#pragma omp target /* { dg-warning "target construct inside of target region" } */ + ; +#pragma omp target data /* { dg-warning "target data construct inside of target region" } */ + ; +#pragma omp target update to(i) /* { dg-warning "target update construct inside of target region" } */ + +#pragma omp parallel + { +#pragma omp target /* { dg-warning "target construct inside of target region" } */ + ; +#pragma omp target data /* { dg-warning "target data construct inside of target region" } */ + ; +#pragma omp target update to(i) /* { dg-warning "target update construct inside of target region" } */ + } + } +}