From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 57623 invoked by alias); 13 Oct 2015 07:15:33 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 57607 invoked by uid 89); 13 Oct 2015 07:15:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 13 Oct 2015 07:15:30 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 23C27C0BFD0E for ; Tue, 13 Oct 2015 07:15:29 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-53.ams2.redhat.com [10.36.116.53]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9D7FRId002217 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 13 Oct 2015 03:15:28 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id t9D7FQhp030443 for ; Tue, 13 Oct 2015 09:15:26 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id t9D7FPQQ030442 for gcc-patches@gcc.gnu.org; Tue, 13 Oct 2015 09:15:25 +0200 Date: Tue, 13 Oct 2015 07:15:00 -0000 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [gomp4.1] Disallow modifiers on linear clause except in declare simd Message-ID: <20151013071524.GB478@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg01186.txt.bz2 Hi! Modifiers are only meaningful in declare simd construct, therefore latest OpenMP 4.5 disallows them on simd/for constructs. 2015-10-13 Jakub Jelinek c/ * c-typeck.c (c_finish_omp_clauses): Disallow modifiers on simd/for constructs. cp/ * semantics.c (finish_omp_clauses): Disallow modifiers on simd/for constructs. testsuite/ * c-c++-common/gomp/linear-1.c: New test. * g++.dg/gomp/linear-1.C: New test. --- gcc/c/c-typeck.c.jj 2015-10-09 11:17:17.000000000 +0200 +++ gcc/c/c-typeck.c 2015-10-09 19:05:48.433813759 +0200 @@ -12470,6 +12470,14 @@ c_finish_omp_clauses (tree clauses, bool if (!declare_simd) need_implicitly_determined = true; t = OMP_CLAUSE_DECL (c); + if (!declare_simd + && OMP_CLAUSE_LINEAR_KIND (c) != OMP_CLAUSE_LINEAR_DEFAULT) + { + error_at (OMP_CLAUSE_LOCATION (c), + "modifier should not be specified in % " + "clause on % or % constructs"); + OMP_CLAUSE_LINEAR_KIND (c) = OMP_CLAUSE_LINEAR_DEFAULT; + } if (!INTEGRAL_TYPE_P (TREE_TYPE (t)) && TREE_CODE (TREE_TYPE (t)) != POINTER_TYPE) { --- gcc/cp/semantics.c.jj 2015-10-09 11:19:37.000000000 +0200 +++ gcc/cp/semantics.c 2015-10-09 19:07:12.604636561 +0200 @@ -5725,6 +5725,14 @@ finish_omp_clauses (tree clauses, bool a case OMP_CLAUSE_LINEAR: field_ok = allow_fields; t = OMP_CLAUSE_DECL (c); + if (!declare_simd + && OMP_CLAUSE_LINEAR_KIND (c) != OMP_CLAUSE_LINEAR_DEFAULT) + { + error_at (OMP_CLAUSE_LOCATION (c), + "modifier should not be specified in % " + "clause on % or % constructs"); + OMP_CLAUSE_LINEAR_KIND (c) = OMP_CLAUSE_LINEAR_DEFAULT; + } if ((VAR_P (t) || TREE_CODE (t) == PARM_DECL) && !type_dependent_expression_p (t)) { --- gcc/testsuite/c-c++-common/gomp/linear-1.c.jj 2015-10-12 10:59:33.058013750 +0200 +++ gcc/testsuite/c-c++-common/gomp/linear-1.c 2015-10-12 11:25:31.633491633 +0200 @@ -0,0 +1,42 @@ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +int i; + +#pragma omp declare simd linear (val (x) : 1) linear (y : 2) +int bar (int x, int y, int z); + +void +foo (int x, int y) +{ + #pragma omp simd linear (i: 3) + for (i = 0; i < 33; i += 3) + ; + #pragma omp simd linear (val (i): 3) /* { dg-error "modifier should not be specified in" } */ + for (i = 0; i < 33; i += 3) + ; + #pragma omp simd linear (x: y + 1) + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp simd linear (val (x): y + 1) /* { dg-error "modifier should not be specified in" } */ + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for linear (x: y + 1) + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for linear (val (x): y + 1) /* { dg-error "modifier should not be specified in" } */ + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for simd linear (i: 3) + for (i = 0; i < 33; i += 3) + ; + #pragma omp for simd linear (val (i): 3) /* { dg-error "modifier should not be specified in" } */ + for (i = 0; i < 33; i += 3) + ; + #pragma omp for simd linear (x: y + 1) + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for simd linear (val (x): y + 1) /* { dg-error "modifier should not be specified in" } */ + for (i = 0; i < 10; i++) + x += y + 1; +} --- gcc/testsuite/g++.dg/gomp/linear-1.C.jj 2015-10-12 11:37:13.327880757 +0200 +++ gcc/testsuite/g++.dg/gomp/linear-1.C 2015-10-12 11:39:16.052024819 +0200 @@ -0,0 +1,48 @@ +// { dg-do compile } +// { dg-options "-fopenmp" } + +int i; + +#pragma omp declare simd linear (ref (x) : 1) linear (uval (y) : 2) +int bar (int &x, int &y, int z); + +void +foo (int &x, int &y) +{ + #pragma omp simd linear (x: y + 1) + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp simd linear (val (x): y + 1) // { dg-error "modifier should not be specified in" } + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp simd linear (ref (x): y + 1) // { dg-error "modifier should not be specified in" } + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp simd linear (uval (x): y + 1) // { dg-error "modifier should not be specified in" } + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for linear (x: y + 1) + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for linear (val (x): y + 1) // { dg-error "modifier should not be specified in" } + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for linear (ref (x): y + 1) // { dg-error "modifier should not be specified in" } + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for linear (uval (x): y + 1) // { dg-error "modifier should not be specified in" } + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for simd linear (x: y + 1) + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for simd linear (val (x): y + 1) // { dg-error "modifier should not be specified in" } + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for simd linear (ref (x): y + 1) // { dg-error "modifier should not be specified in" } + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for simd linear (uval (x): y + 1) // { dg-error "modifier should not be specified in" } + for (i = 0; i < 10; i++) + x += y + 1; +} Jakub