From owner-sc22wg5+sc22wg5-dom9=www.open-std.org@open-std.org  Tue Sep 12 19:30:13 2023
Return-Path: <owner-sc22wg5+sc22wg5-dom9=www.open-std.org@open-std.org>
X-Original-To: sc22wg5-dom9
Delivered-To: sc22wg5-dom9@www.open-std.org
Received: by www.open-std.org (Postfix, from userid 521)
	id 9CD3D356992; Tue, 12 Sep 2023 19:30:13 +0200 (CEST)
Delivered-To: sc22wg5@open-std.org
X-Greylist: delayed 487 seconds by postgrey-1.34 at www5.open-std.org; Tue, 12 Sep 2023 19:30:13 CEST
Received: from smtp-out-3.tiscali.co.uk (smtp-out-3.tiscali.co.uk [62.24.135.131])
	by www.open-std.org (Postfix) with ESMTP id 5490335696B
	for <sc22wg5@open-std.org>; Tue, 12 Sep 2023 19:30:13 +0200 (CEST)
Received: from [10.197.1.247] ([2.100.205.99])
	by smtp.talktalk.net with SMTP
	id g75Rqyz5ytzMrg75RqHYS7; Tue, 12 Sep 2023 18:22:05 +0100
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=talktalk.net;
	s=cmr1711; t=1694539325;
	bh=DG+XCxSJMPwqkYgU2MYfEkL93jUHmSrCoIIBJeSUVG4=;
	h=Subject:To:References:From:Date:In-Reply-To;
	b=GTSAAu3ZvXzIUlTlDSpM1lbFilnF8Z4GD9mFoTUpbyk7E6uoL1ZNH/608hjbwwx/J
	 qFbNuBfqF+WxcCSGj8C86B7bEdvb21lNG/u3018/5WQ+Xga7EfGAkXztTVf2Qws6b3
	 FMHnxjXodK481xkULGZY+4dT98klJgX8Rr2hSGxY=
X-Originating-IP: [2.100.205.99]
Subject: Re: [ukfortran] [SC22WG5.6477] [J3] are race conditions allowed in do
 concurrent?
To: WG5 <sc22wg5@open-std.org>
References: <DM6PR12MB31302BD1D034319D5CD42B7ACBF1A@DM6PR12MB3130.namprd12.prod.outlook.com>
 <20230912161937.ED0F6356986@www.open-std.org>
From: John Reid <john.reid9@talktalk.net>
Message-ID: <42b53b63-5da4-4769-c24e-3ed0576e7654@talktalk.net>
Date: Tue, 12 Sep 2023 18:22:05 +0100
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:91.0) Gecko/20100101
 Firefox/91.0 SeaMonkey/2.53.17
MIME-Version: 1.0
In-Reply-To: <20230912161937.ED0F6356986@www.open-std.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-CMAE-Envelope: MS4wfEMOpxqoktpCX+WkUoY5Lv3tCH3TGUYLDg22sTzDSGC3zgpVKmdNyqmd7vqj0Dxkr0W3lGGDJ/sfvuHJqg4Q2S99MDsydQDH0W6XtqoQJX2i8qg35Uvp
 nl1lAhZVfeOc22tHDFNphv/YpT6L0gHt7WcllOp2EfQiBlxyQswP1RtMAVdEQooR3cGxTdTM6qFCw2D8CQGrRQkG1fEnO60WjsE=
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

Brad and Jeff,

What is missing, I think, is to say that if an array is declared as 
shared, all its elements are shared.

Cheers,

John.


Brad Richardson wrote:
> Hi Jeff,
>
> Based on " If it is defined or becomes undefined during any iteration, 
> it shall not be referenced, defined, or become undefined during any 
> other iteration.", the provide program is invalid, because `x` becomes 
> defined in more than one iteration.
>
> The way I've heard "definition" applied to arrays is that definition 
> of an element of an array does not constitute definition of the 
> variable, because it is then only partially defined. I.e. an array is 
> only defined once each of its elements has been defined.
>
> My opinion is that the above constraint simply does not adequately 
> describe/is still ambiguous about the case of arrays. I think an 
> interp would be warranted, and we should say that an element of an 
> array should have the same constraint as above if the variable is shared.
>
> Regards,
> Brad
>
> On Tue, 2023-09-12 at 14:43 +0000, Jeff Hammond via J3 wrote:
>>
>> Is this a legal program in Fortran with defined behavior?  If it is 
>> illegal or the behavior is undefined, where do we say that?
>>
>> program main
>>
>>   integer :: k
>>
>>   real :: x
>>
>>   x = 0.0
>>
>>   do concurrent (k=1:2) shared(x)
>>
>>     x = real(k)
>>
>>   end do
>>
>>   print*,x
>>
>> end program main
>>
>> Is that what the following is intended to do?
>>
>> “If a variable has SHARED locality, appearances of the variable 
>> within the DO CONCURRENT construct refer to the variable in the 
>> innermost executable construct or scoping unit that includes the DO 
>> CONCURRENT construct. If it is defined or becomes undefined during 
>> any iteration, it shall not be referenced, defined, or become 
>> undefined during any other iteration.”
>>
>> If so, then I am struggling to apply this to arrays.  When we say a 
>> variable has shared locality, is the variable the array or the 
>> element?  We can only put array names in SHARED(), but applying the 
>> text regarding “to become defined” from the perspective of arrays 
>> appears to have interesting consequences.
>>
>> Thanks,
>>
>>
>> Jeff
>>
>
>
> _______________________________________________
> ukfortran mailing list
> https://lists.accu.org/mailman/listinfo/ukfortran

