From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 129359 invoked by alias); 19 Mar 2015 18:43:12 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 129344 invoked by uid 89); 19 Mar 2015 18:43:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_FROM_URIBL_PCCC,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-wg0-f47.google.com Received: from mail-wg0-f47.google.com (HELO mail-wg0-f47.google.com) (74.125.82.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 19 Mar 2015 18:43:10 +0000 Received: by wgbcc7 with SMTP id cc7so70208364wgb.0 for ; Thu, 19 Mar 2015 11:43:07 -0700 (PDT) X-Received: by 10.194.6.70 with SMTP id y6mr151285112wjy.97.1426790587858; Thu, 19 Mar 2015 11:43:07 -0700 (PDT) Received: from msticlxl57.ims.intel.com ([192.55.54.40]) by mx.google.com with ESMTPSA id q10sm3036367wjr.41.2015.03.19.11.43.04 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Mar 2015 11:43:07 -0700 (PDT) Date: Thu, 19 Mar 2015 18:43:00 -0000 From: Ilya Verbin To: Jakub Jelinek Cc: gcc@gcc.gnu.org, Kirill Yukhin Subject: Re: [gomp4] Questions about "declare target" and "target update" pragmas Message-ID: <20150319184258.GB20881@msticlxl57.ims.intel.com> References: <20140122155151.GA50489@msticlxl57.ims.intel.com> <20150310165252.GC37666@msticlxl57.ims.intel.com> <20150316184153.GA42550@msticlxl57.ims.intel.com> <20150319134744.GW1746@tucnak.redhat.com> <20150319144947.GA20881@msticlxl57.ims.intel.com> <20150319145710.GY1746@tucnak.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150319145710.GY1746@tucnak.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00237.txt.bz2 On Thu, Mar 19, 2015 at 15:57:10 +0100, Jakub Jelinek wrote: > On Thu, Mar 19, 2015 at 05:49:47PM +0300, Ilya Verbin wrote: > > If I understand correctly, it's not allowed to map global target arrays this > > way, since it's already present in the initial device data environment: > > It of course is allowed. It just means that it doesn't allocate new memory > (sizeof(int) large in the map(a1[10]) case, sizeof(int)*50 large in the map(a1[0:50]) > case), nor copy the bytes around, all it will do is allocate memory for the > target copy of the a1 pointer, and do pointer transformation such that the > a1 pointer on the target will point to the global target a1 array. > Without the map(a1[10]) or map(a1[0:50]) clauses (i.e. implicit map(tofrom:a1)) > it does similar thing, except it copies the pointer value to the target (and > back at the end of the region) instead, which is not what you want... Ok, got it. And what about global allocatable fortran arrays? I didn't find any restrictions in the specification. Here is a reduced testcase: module test integer, allocatable, target :: x(:) !$omp declare target(x) end module test use test integer :: n = 1000 allocate (x(n)) !$omp target map(x(1:n)) x(123) = 456 !$omp end target deallocate (x) end It crashes on target with NULL-pointer access, however the memory for x(1:n) is allocated on target. Looks like there's something wrong with pointer transformation. Is this a wrong testcase or a bug in gcc? Thanks, -- Ilya