From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60118 invoked by alias); 13 Oct 2015 07:17:45 -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 60103 invoked by uid 89); 13 Oct 2015 07:17:44 -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:17:43 +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 828CEC0BFD0A for ; Tue, 13 Oct 2015 07:17:41 +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 t9D7HdOw003615 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 13 Oct 2015 03:17:41 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id t9D7HcJl030453 for ; Tue, 13 Oct 2015 09:17:38 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id t9D7HcuE030452 for gcc-patches@gcc.gnu.org; Tue, 13 Oct 2015 09:17:38 +0200 Date: Tue, 13 Oct 2015 07:17:00 -0000 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [gomp4.1] Disallow multiple depend(source) or mixing source + sink Message-ID: <20151013071738.GC478@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/msg01187.txt.bz2 Hi! Multiple depend(source) is useless and it has been agreed on that we should disallow it. Similarly, when mixing sink and source on the same ordered construct, we'd either need to define behavior for it, or disallow it, where the latter is what we've done for clarity reasons. The testcase also verifies diagnostics for the case where ordered is less than collapse. 2015-10-13 Jakub Jelinek * gimplify.c (gimplify_omp_ordered): Disallow multiple depend(source) clauses on the same construct. Disallow depend(source) combined with depend(sink:vec) on the same construct. * omp-low.c (check_omp_nesting_restrictions): Remove pointless asserts. testsuite/ * c-c++-common/gomp/doacross-1.c: New test. --- gcc/gimplify.c.jj 2015-10-09 09:28:04.000000000 +0200 +++ gcc/gimplify.c 2015-10-12 12:37:32.065883694 +0200 @@ -8743,6 +8743,8 @@ gimplify_omp_ordered (tree expr, gimple_ tree c, decls; int failures = 0; unsigned int i; + tree source_c = NULL_TREE; + tree sink_c = NULL_TREE; if (gimplify_omp_ctxp) for (c = OMP_ORDERED_CLAUSES (expr); c; c = OMP_CLAUSE_CHAIN (c)) @@ -8772,13 +8774,33 @@ gimplify_omp_ordered (tree expr, gimple_ if (!fail && i != gimplify_omp_ctxp->loop_iter_var.length () / 2) { error_at (OMP_CLAUSE_LOCATION (c), - "number of variables in depend(sink) " + "number of variables in % " "clause does not match number of " "iteration variables"); - fail = true; failures++; } + sink_c = c; } + else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_DEPEND + && OMP_CLAUSE_DEPEND_KIND (c) == OMP_CLAUSE_DEPEND_SOURCE) + { + if (source_c) + { + error_at (OMP_CLAUSE_LOCATION (c), + "more than one % clause on an " + "% construct"); + failures++; + } + else + source_c = c; + } + if (source_c && sink_c) + { + error_at (OMP_CLAUSE_LOCATION (source_c), + "% clause specified together with " + "% clauses on the same construct"); + failures++; + } if (failures) return gimple_build_nop (); --- gcc/omp-low.c.jj 2015-10-02 11:38:40.000000000 +0200 +++ gcc/omp-low.c 2015-10-12 12:21:32.081523021 +0200 @@ -3348,8 +3348,6 @@ check_omp_nesting_restrictions (gimple s || OMP_CLAUSE_DEPEND_KIND (c) == OMP_CLAUSE_DEPEND_SINK)) { enum omp_clause_depend_kind kind = OMP_CLAUSE_DEPEND_KIND (c); - gcc_assert (kind == OMP_CLAUSE_DEPEND_SOURCE - || kind == OMP_CLAUSE_DEPEND_SINK); error_at (OMP_CLAUSE_LOCATION (c), "% is only allowed in %", kind == OMP_CLAUSE_DEPEND_SOURCE ? "source" : "sink"); @@ -3455,8 +3453,6 @@ check_omp_nesting_restrictions (gimple s || OMP_CLAUSE_DEPEND_KIND (c) == OMP_CLAUSE_DEPEND_SINK)) { enum omp_clause_depend_kind kind = OMP_CLAUSE_DEPEND_KIND (c); - gcc_assert (kind == OMP_CLAUSE_DEPEND_SOURCE - || kind == OMP_CLAUSE_DEPEND_SINK); error_at (OMP_CLAUSE_LOCATION (c), "% is only allowed in %", kind == OMP_CLAUSE_DEPEND_SOURCE ? "source" : "sink"); --- gcc/testsuite/c-c++-common/gomp/doacross-1.c.jj 2015-10-12 12:01:39.528659576 +0200 +++ gcc/testsuite/c-c++-common/gomp/doacross-1.c 2015-10-12 12:46:57.691262361 +0200 @@ -0,0 +1,48 @@ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +void +foo (void) +{ + int i, j, k; + #pragma omp for ordered (1) + for (i = 0; i < 64; i++) + { + #pragma omp ordered depend (sink: i - 1) + #pragma omp ordered depend (source) + } + #pragma omp for ordered (1) collapse (1) + for (i = 0; i < 64; i++) + { + #pragma omp ordered depend (sink: i - 1) + #pragma omp ordered depend (source) + } + #pragma omp for collapse (2) ordered (1) /* { dg-error "clause parameter is less than" } */ + for (i = 0; i < 64; i++) + for (j = 0; j < 64; j++) + { + #pragma omp ordered depend (sink: i - 1) /* { dg-error "does not match number" } */ + #pragma omp ordered depend (source) + } + #pragma omp for ordered (2) collapse (3) /* { dg-error "clause parameter is less than" } */ + for (i = 0; i < 64; i++) + for (j = 0; j < 64; j++) + for (k = 0; k < 64; k++) + { + #pragma omp ordered depend (sink: i - 1, j - 2) /* { dg-error "does not match number" } */ + #pragma omp ordered depend (source) + } + #pragma omp ordered depend (sink: j) /* { dg-error "clause must be closely nested inside an ordered loop" } */ + #pragma omp ordered depend (source) /* { dg-error "clause must be closely nested inside an ordered loop" } */ + #pragma omp for ordered (1) + for (i = 0; i < 64; i++) + { + #pragma omp ordered depend (sink: i - 1) depend (sink: i - 2) + #pragma omp ordered depend (source) depend (source) /* { dg-error "more than one .depend.source.. clause on an" } */ + } + #pragma omp for ordered (1) + for (i = 0; i < 64; i++) + { + #pragma omp ordered depend (sink: i - 1) depend (source) depend (sink: i - 2) /* { dg-error "clause specified together with" } */ + } +} Jakub