From patchwork Fri Oct 9 09:14:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 528136 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 8AC1F1402A1 for ; Fri, 9 Oct 2015 20:14:46 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=oY5f/WuP; 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:date :from:to:subject:message-id:reply-to:mime-version:content-type; q=dns; s=default; b=nmKdmNXD3c56mb+rlj1Ziq4gynzPSUJy2EGsnxNghdC DFEwL5xpRBb2sUjr74g+fnsjtDeB6CGtrVR3KDbYjkasFw3Fj2k36OjTjCwVxeil ElitbaiRZc5Xvxv/iDTE4pmltAo1kUTpC8jyR6UzLX9rCiHirfltvyUYhc0qDcMA = 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:date :from:to:subject:message-id:reply-to:mime-version:content-type; s=default; bh=NX/TGJgnm+S64xuXU1gG8iga4rk=; b=oY5f/WuPQi3HUZ8DN lKmHiWxPggoH0/EgCS90JMKz2D8faXGgO4j0CYsZEpMCBs0xH3a9qzpZNstUINrq 7eNwcyD8y9F00ireKbXb/XItjfeWCjfWlBGfb9xXqLY2T5mJRDEZw4F5w1KBAsi2 E4Bb28N0Y7Q9GwcNzg20UoOkLY= Received: (qmail 69491 invoked by alias); 9 Oct 2015 09:14:40 -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 69481 invoked by uid 89); 9 Oct 2015 09:14:39 -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; Fri, 09 Oct 2015 09:14:38 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id E0D95A19BB for ; Fri, 9 Oct 2015 09:14:36 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-44.ams2.redhat.com [10.36.116.44]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t999EY2q002617 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Fri, 9 Oct 2015 05:14:36 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id t999EXqM009572 for ; Fri, 9 Oct 2015 11:14:33 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id t999EXGs009571 for gcc-patches@gcc.gnu.org; Fri, 9 Oct 2015 11:14:33 +0200 Date: Fri, 9 Oct 2015 11:14:33 +0200 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [gomp4.1] Two more array section testcases Message-ID: <20151009091433.GE8714@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Hi! The 4.0 spec required that low-bound in array section must not be negative. The 4.5 spec removes that restriction, for arrays it is obvious that it is invalid anyway (pointer arithmetics disallows that), and for pointers it is meaningful. After looking what I've implemented, it seems I've applied common sense rather than strictly reading the standard. And that is the behavior we want for OpenMP 4.5, so I've just added new testcases to cover the various cases. 2015-10-09 Jakub Jelinek * c-c++-common/gomp/depend-4.c: New test. * c-c++-common/gomp/map-2.c: New test. Jakub --- gcc/testsuite/c-c++-common/gomp/depend-4.c.jj 2015-10-09 11:04:54.676862229 +0200 +++ gcc/testsuite/c-c++-common/gomp/depend-4.c 2015-10-09 11:04:46.359979185 +0200 @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +void +foo (int *p, int (*q)[10], int r[10], int s[10][10]) +{ + int a[10], b[10][10]; + #pragma omp task depend (inout: p[-1:2]) + ; + #pragma omp task depend (inout: q[-1:2][2:4]) + ; + #pragma omp task depend (inout: q[-1:2][-2:4]) /* { dg-error "negative low bound in array section in" } */ + ; + #pragma omp task depend (inout: r[-1:2]) + ; + #pragma omp task depend (inout: s[-1:2][2:4]) + ; + #pragma omp task depend (inout: s[-1:2][-2:4]) /* { dg-error "negative low bound in array section in" } */ + ; + #pragma omp task depend (inout: a[-1:2]) /* { dg-error "negative low bound in array section in" } */ + ; + #pragma omp task depend (inout: b[-1:2][2:4]) /* { dg-error "negative low bound in array section in" } */ + ; + #pragma omp task depend (inout: b[1:2][-2:4]) /* { dg-error "negative low bound in array section in" } */ + ; +} --- gcc/testsuite/c-c++-common/gomp/map-2.c.jj 2015-10-09 11:05:40.752214292 +0200 +++ gcc/testsuite/c-c++-common/gomp/map-2.c 2015-10-09 11:07:19.558824818 +0200 @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +void +foo (int *p, int (*q)[10], int r[10], int s[10][10]) +{ + int a[10], b[10][10]; + #pragma omp target map (tofrom: p[-1:2]) + ; + #pragma omp target map (tofrom: q[-1:2][0:10]) + ; + #pragma omp target map (tofrom: q[-1:2][-2:10]) /* { dg-error "negative low bound in array section in" } */ + ; + #pragma omp target map (tofrom: r[-1:2]) + ; + #pragma omp target map (tofrom: s[-1:2][:]) + ; + #pragma omp target map (tofrom: s[-1:2][-2:10]) /* { dg-error "negative low bound in array section in" } */ + ; + #pragma omp target map (tofrom: a[-1:2]) /* { dg-error "negative low bound in array section in" } */ + ; + #pragma omp target map (tofrom: b[-1:2][0:]) /* { dg-error "negative low bound in array section in" } */ + ; + #pragma omp target map (tofrom: b[1:2][-2:10]) /* { dg-error "negative low bound in array section in" } */ + ; +}