From owner-sc22wg5+sc22wg5-dom9=www.open-std.org@open-std.org  Thu Sep 14 07:11:37 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 5FF0A3569E9; Thu, 14 Sep 2023 07:11:37 +0200 (CEST)
Delivered-To: sc22wg5@open-std.org
X-Greylist: delayed 398 seconds by postgrey-1.34 at www5.open-std.org; Thu, 14 Sep 2023 07:11:32 CEST
Received: from nag-j.co.jp (bvdeuz19.secure.ne.jp [180.222.80.19])
	by www.open-std.org (Postfix) with SMTP id 044A53569C2
	for <sc22wg5@open-std.org>; Thu, 14 Sep 2023 07:11:31 +0200 (CEST)
Received: (qmail 76246 invoked from network); 14 Sep 2023 14:04:47 +0900
Received: from unknown (HELO Maru10) (218.42.159.105)
  by 0 with SMTP; 14 Sep 2023 14:04:47 +0900
From: "Malcolm Cohen" <malcolm@nag-j.co.jp>
To: "'WG5'" <sc22wg5@open-std.org>
References: <DM6PR12MB31302BD1D034319D5CD42B7ACBF1A@DM6PR12MB3130.namprd12.prod.outlook.com> <20230912161937.ED0F6356986@www.open-std.org> <493F5A4F-8746-4CA4-ACF7-554B71168255@nasa.gov> <20230912184902.A227F35699F@www.open-std.org>
In-Reply-To: <20230912184902.A227F35699F@www.open-std.org>
Subject: RE: [ukfortran] [SC22WG5.6480] [EXTERNAL] [BULK] [J3] are race conditions allowed in do concurrent?
Date: Thu, 14 Sep 2023 14:04:49 +0900
Message-ID: <002f01d9e6c8$fcd845a0$f688d0e0$@nag-j.co.jp>
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_0030_01D9E714.6CC25EA0"
X-Mailer: Microsoft Outlook 16.0
Thread-Index: AQG/qXZQcGIQLpZ1F3Ca3tHLE/EEbAFGgQaEAuD8HXAB7pdlIbAdh2GQ
Content-Language: ja
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

This is a multipart message in MIME format.

------=_NextPart_000_0030_01D9E714.6CC25EA0
Content-Type: text/plain;
	charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Hi Brad,

=20

There is no contradiction, subtle or otherwise, here.

=20

Locality-specs are only for named variables. However, as noted, =
subobjects of variables are also variables.

=20

> 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,

=20

Correct (except in the trivial case of an array with a single element). =
This is all spelled out explicitly: defining every =
=E2=80=9Cpart=E2=80=9D of a multi-part variable defines the variable.

=20

I can see some potential wording improvements for the next revision, but =
nothing that rises to the level of a defect.

=20

E.g. it may be better to mention that =E2=80=9Cif a variable has SHARED =
locality, all of its subobjects have SHARED locality=E2=80=9D. =
It=E2=80=99s not written there now, because, like, how could it possibly =
be anything else? There is nothing else it could be.  But making it =
explicit would lead naturally into writing =E2=80=9CIf a variable with =
SHARED locality is defined=E2=80=A6=E2=80=9D instead of the current =
=E2=80=9CIf it is defined=E2=80=A6=E2=80=9D.

=20

>variable/data entity/data object

>[are] circular, and doesn't seem to include individual array elements

=20

Yes it does, see 3.138 subobject.

=20

The circularity is unfortunate, but they are all reasonably worded for =
comprehensibility (not for trail-following). So it=E2=80=99s either =
deleting one of them (ugh) or rewording one to break the circle without =
making it hard to understand (it=E2=80=99s not obvious exactly what to =
do here, which is why it is still like this).

=20

If it were a glossary of terms, instead of a list of definitions, there =
would be no problem with circularity, right?

=20

Anyway, I agree it would be good to fix it as long as it doesn=E2=80=99t =
make any individual term hard to understand.

=20

Given our experience this time around, I would be in favour of pruning =
our terms and definitions, down to a more minimal set. If there are =
=E2=80=9Cuseful=E2=80=9D terms that do not lend themselves to trivial =
drop-in replacement, and I think there are, we could consider adding a =
=E2=80=9CGlossary=E2=80=9D (of =E2=80=9Cuseful terms=E2=80=9D, but =
probably better not to call them =E2=80=9Cterms=E2=80=9D!).=20

=20

Cheers,

--=20

..............Malcolm Cohen, NAG Oxford/Tokyo.

=20

From: Brad Richardson <everythingfunctional@protonmail.com>=20
Sent: Wednesday, September 13, 2023 3:49 AM
To: General J3 interest list <j3@mailman.j3-fortran.org>; WG5 =
<sc22wg5@open-std.org>
Subject: [ukfortran] [SC22WG5.6480] [EXTERNAL] [BULK] [J3] are race =
conditions allowed in do concurrent?

=20

Hmm... I decided to work through this a bit more thoroughly.

=20

From the syntax definitions:

=20

R902

variable

is designator

or function-reference

=20

R901

designator

is object-name

or array-element

or array-section

or coindexed-named-object

or complex-part-designator

or structure-component

or substring

=20

=20

Ok, so according to the syntax an array element is a variable.

=20

From the terms and definitions:

=20

variable

data entity (3.41) that can be defined (3.48) and redefined during =
execution of a program

=20

data entity

data object (3.42), result of the evaluation of an expression, or the =
result of the execution of a function reference

=20

data object

constant, variable, or subobject of a constant

=20

which is circular, and doesn't seem to include individual array =
elements.

=20

So now the question is which "definition" does the DO CONCURRENT =
constraint refer to?

=20

From the syntax definitions:

=20

R1129

concurrent-locality

is

[ locality-spec ]...

=20

R1130

locality-spec

is LOCAL ( variable-name-list )

or LOCAL_INIT ( variable-name-list )

or REDUCE ( reduce-operation : variable-name-list )

or SHARED ( variable-name-list )

or DEFAULT ( NONE )

=20

only allows variable-name, not designator, so it's not exactly clear.

=20

The "constraint" appears in normative text, I.e.

=20

If a variable has

=20

which is not hyperlinked and is not in a font indicating reference to =
the syntax term.

=20

My reading of this is that we have a subtle contradiction between the =
syntax and normative terms. My guess is that the syntax meaning (i.e. an =
array element is a variable) is what is intended for the rules here, and =
thus it's valid to (un)define *different* elements of an array in =
separate iterations, but not valid to (un)define and reference the same =
element of an array in separate iterations.

=20

I think it would be worth "fixing" the terms and definitions to =
eliminate the circular definition and make it consistent with the =
syntax.

=20

Regards,

Brad

=20

On Tue, 2023-09-12 at 17:37 +0000, Clune, Thomas L. (GSFC-6101) wrote:

=E2=80=9CVariable=E2=80=9D does not mean what we think it means:     =
<variable>   <<is>>  <designator> <<or>> <function-reference>

=20

And <designator> includes <array-element>.

=20

But I for one would not mind an explanatory note that clarifies the =
common use case of array elements in this context.=20

=20

=20

=20

From:J3 <j3-bounces@mailman.j3-fortran.org =
<mailto:j3-bounces@mailman.j3-fortran.org> > on behalf of j3 =
<j3@mailman.j3-fortran.org <mailto:j3@mailman.j3-fortran.org> >
Reply-To: j3 <j3@mailman.j3-fortran.org =
<mailto:j3@mailman.j3-fortran.org> >
Date: Tuesday, September 12, 2023 at 12:19 PM
To: j3 <j3@mailman.j3-fortran.org <mailto:j3@mailman.j3-fortran.org> >, =
WG5 <sc22wg5@open-std.org <mailto:sc22wg5@open-std.org> >
Cc: Brad Richardson <everythingfunctional@protonmail.com =
<mailto:everythingfunctional@protonmail.com> >
Subject: [EXTERNAL] [BULK] [J3] [SC22WG5.6477] are race conditions =
allowed in do concurrent?

=20


CAUTION: This email originated from outside of NASA.  Please take care =
when clicking links or opening attachments.  Use the "Report Message" =
button to report suspicious messages to the NASA SOC.=20






Hi Jeff,

=20

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.

=20

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.

=20

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.

=20

Regards,

Brad

=20

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?

=20

program main

  integer :: k

  real :: x

  x =3D 0.0

  do concurrent (k=3D1:2) shared(x)

    x =3D real(k)

  end do

  print*,x

end program main

=20

Is that what the following is intended to do?

=20

=E2=80=9CIf 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.=E2=80=9D

=20

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 =
=E2=80=9Cto become defined=E2=80=9D from the perspective of arrays =
appears to have interesting consequences.

=20

Thanks,


Jeff

=20

=20

=20


------=_NextPart_000_0030_01D9E714.6CC25EA0
Content-Type: text/html;
	charset="utf-8"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40"><head><meta =
http-equiv=3DContent-Type content=3D"text/html; charset=3Dutf-8"><meta =
name=3DGenerator content=3D"Microsoft Word 15 (filtered =
medium)"><style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:=E6=B8=B8=E3=82=B4=E3=82=B7=E3=83=83=E3=82=AF;
	panose-1:2 11 4 0 0 0 0 0 0 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:"\@=E6=B8=B8=E3=82=B4=E3=82=B7=E3=83=83=E3=82=AF";
	panose-1:2 11 4 0 0 0 0 0 0 0;}
@font-face
	{font-family:Consolas;
	panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;
	mso-ligatures:standardcontextual;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#0563C1;
	text-decoration:underline;}
span.31
	{mso-style-type:personal-reply;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;
	mso-ligatures:none;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]--></head><body lang=3DEN-GB =
link=3D"#0563C1" vlink=3D"#954F72" style=3D'word-wrap:break-word'><div =
class=3DWordSection1><p class=3DMsoNormal>Hi Brad,<o:p></o:p></p><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal>There is no =
contradiction, subtle or otherwise, here.<o:p></o:p></p><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p =
class=3DMsoNormal>Locality-specs are only for named variables. However, =
as noted, subobjects of variables are also variables.<o:p></o:p></p><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal>&gt;<span =
style=3D'mso-ligatures:none'> <span lang=3DEN-US>The way I've heard =
&quot;definition&quot; applied to arrays is that definition of an =
element of an array does not constitute definition of the =
variable,<o:p></o:p></span></span></p><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'>Correct (except in the trivial case of an =
array with a single element). This is all spelled out explicitly: =
defining every =E2=80=9Cpart=E2=80=9D of a multi-part variable defines =
the variable.<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>I can =
see some potential wording improvements for the next revision, but =
nothing that rises to the level of a defect.<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>E.g. =
it may be better to mention that =E2=80=9Cif a variable has SHARED =
locality, all of its subobjects have SHARED locality=E2=80=9D. =
It=E2=80=99s not written there now, because, like, how could it possibly =
be anything else? There is nothing else it could be. =C2=A0But making it =
explicit would lead naturally into writing =E2=80=9CIf a variable with =
SHARED locality is defined=E2=80=A6=E2=80=9D instead of the current =
=E2=80=9CIf it is defined=E2=80=A6=E2=80=9D.<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'>&gt;variable/data entity/data =
object<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'>&gt;[are] </span><span lang=3DEN-US =
style=3D'mso-ligatures:none'>circular, and doesn't seem to include =
individual array elements<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>Yes it =
does, see 3.138 subobject.<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>The =
circularity is unfortunate, but they are all reasonably worded for =
comprehensibility (not for trail-following). So it=E2=80=99s either =
deleting one of them (ugh) or rewording one to break the circle without =
making it hard to understand (it=E2=80=99s not obvious exactly what to =
do here, which is why it is still like this).<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>If it =
were a glossary of terms, instead of a list of definitions, there would =
be no problem with circularity, right?<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'>Anyway, I agree it would be good to fix it =
as long as it doesn=E2=80=99t make any individual term hard to =
understand.<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>Given =
our experience this time around, I would be in favour of pruning our =
terms and definitions, down to a more minimal set. If there are =
=E2=80=9Cuseful=E2=80=9D terms that do not lend themselves to trivial =
drop-in replacement, and I think there are, we could consider adding a =
=E2=80=9CGlossary=E2=80=9D (of =E2=80=9Cuseful terms=E2=80=9D, but =
probably better not to call them =E2=80=9Cterms=E2=80=9D!). =
<o:p></o:p></span></p><p class=3DMsoNormal><o:p>&nbsp;</o:p></p><p =
class=3DMsoNormal>Cheers,<o:p></o:p></p><div><p class=3DMsoNormal =
style=3D'text-align:justify'><span lang=3DEN-US =
style=3D'font-size:10.5pt;mso-ligatures:none'>-- </span><span =
style=3D'font-size:10.5pt;mso-ligatures:none'><o:p></o:p></span></p><p =
class=3DMsoNormal style=3D'text-align:justify'><span lang=3DEN-US =
style=3D'font-size:10.5pt;mso-ligatures:none'>..............Malcolm =
Cohen, NAG Oxford/Tokyo.</span><span =
style=3D'font-size:10.5pt;mso-ligatures:none'><o:p></o:p></span></p></div=
><p class=3DMsoNormal><o:p>&nbsp;</o:p></p><div><div =
style=3D'border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm =
0cm 0cm'><p class=3DMsoNormal><b><span =
style=3D'mso-ligatures:none'>From:</span></b><span =
style=3D'mso-ligatures:none'> Brad Richardson =
&lt;everythingfunctional@protonmail.com&gt; <br><b>Sent:</b> Wednesday, =
September 13, 2023 3:49 AM<br><b>To:</b> General J3 interest list =
&lt;j3@mailman.j3-fortran.org&gt;; WG5 =
&lt;sc22wg5@open-std.org&gt;<br><b>Subject:</b> [ukfortran] =
[SC22WG5.6480] [EXTERNAL] [BULK] [J3] are race conditions allowed in do =
concurrent?<o:p></o:p></span></p></div></div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><div><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'mso-ligatures:none'>Hmm... I decided to work =
through this a bit more thoroughly.<o:p></o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>From =
the syntax definitions:<o:p></o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'>R902<o:p></o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'>variable<o:p></o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>is =
designator<o:p></o:p></span></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'mso-ligatures:none'>or =
function-reference<o:p></o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'>R901<o:p></o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'>designator<o:p></o:p></span></p></div><div><=
p class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>is =
object-name<o:p></o:p></span></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'mso-ligatures:none'>or =
array-element<o:p></o:p></span></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'mso-ligatures:none'>or =
array-section<o:p></o:p></span></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'mso-ligatures:none'>or =
coindexed-named-object<o:p></o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>or =
complex-part-designator<o:p></o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>or =
structure-component<o:p></o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>or =
substring<o:p></o:p></span></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>Ok, so =
according to the syntax an array element is a =
variable.<o:p></o:p></span></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>From =
the terms and definitions:<o:p></o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'>variable<o:p></o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>data =
entity (3.41) that can be defined (3.48) and redefined during execution =
of a program<o:p></o:p></span></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>data =
entity<o:p></o:p></span></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'mso-ligatures:none'>data object (3.42), result of =
the evaluation of an expression, or the result of the execution of a =
function reference<o:p></o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>data =
object<o:p></o:p></span></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'mso-ligatures:none'>constant, variable, or =
subobject of a constant<o:p></o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>which =
is circular, and doesn't seem to include individual array =
elements.<o:p></o:p></span></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>So now =
the question is which &quot;definition&quot; does the DO CONCURRENT =
constraint refer to?<o:p></o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>From =
the syntax definitions:<o:p></o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'>R1129<o:p></o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'>concurrent-locality<o:p></o:p></span></p></d=
iv><div><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'>is<o:p></o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>[ =
locality-spec ]...<o:p></o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'>R1130<o:p></o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'>locality-spec<o:p></o:p></span></p></div><di=
v><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'>is LOCAL ( variable-name-list =
)<o:p></o:p></span></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'mso-ligatures:none'>or LOCAL_INIT ( =
variable-name-list )<o:p></o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>or =
REDUCE ( reduce-operation : variable-name-list =
)<o:p></o:p></span></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'mso-ligatures:none'>or SHARED ( variable-name-list =
)<o:p></o:p></span></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'mso-ligatures:none'>or DEFAULT ( NONE =
)<o:p></o:p></span></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>only =
allows variable-name, not designator, so it's not exactly =
clear.<o:p></o:p></span></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>The =
&quot;constraint&quot; appears in normative text, =
I.e.<o:p></o:p></span></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>If a =
variable has<o:p></o:p></span></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>which =
is not hyperlinked and is not in a font indicating reference to the =
syntax term.<o:p></o:p></span></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>My =
reading of this is that we have a subtle contradiction between the =
syntax and normative terms. My guess is that the syntax meaning (i.e. an =
array element is a variable) is what is intended for the rules here, and =
thus it's valid to (un)define *different* elements of an array in =
separate iterations, but not valid to (un)define and reference the same =
element of an array in separate =
iterations.<o:p></o:p></span></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>I =
think it would be worth &quot;fixing&quot; the terms and definitions to =
eliminate the circular definition and make it consistent with the =
syntax.<o:p></o:p></span></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'>Regards,<o:p></o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'>Brad<o:p></o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'mso-ligatures:none'>On =
Tue, 2023-09-12 at 17:37 +0000, Clune, Thomas L. (GSFC-6101) =
wrote:<o:p></o:p></span></p></div><blockquote =
style=3D'border:none;border-left:solid #729FCF 1.5pt;padding:0cm 0cm 0cm =
6.0pt;margin-left:4.8pt;margin-right:0cm'><p class=3DMsoNormal><span =
lang=3DEN-US>=E2=80=9CVariable=E2=80=9D does not mean what we think it =
means:&nbsp;&nbsp;&nbsp;&nbsp; &lt;variable&gt;&nbsp; =
&nbsp;&lt;&lt;is&gt;&gt;&nbsp; &lt;designator&gt; &lt;&lt;or&gt;&gt; =
&lt;function-reference&gt;<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US>&nbsp;<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US>And &lt;designator&gt; includes =
&lt;array-element&gt;.<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>&nbsp;<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>But I for one would not mind an explanatory note that =
clarifies the common use case of array elements in this =
context.&nbsp;<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>&nbsp;<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>&nbsp;<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>&nbsp;<o:p></o:p></span></p><div =
style=3D'border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm =
0cm 0cm'><p class=3DMsoNormal style=3D'margin-left:36.0pt'><b><span =
lang=3DEN-US =
style=3D'font-size:12.0pt;color:black;mso-ligatures:none'>From:</span></b=
><span lang=3DEN-US =
style=3D'font-size:12.0pt;color:black;mso-ligatures:none'>J3 &lt;<a =
href=3D"mailto:j3-bounces@mailman.j3-fortran.org">j3-bounces@mailman.j3-f=
ortran.org</a>&gt; on behalf of j3 &lt;<a =
href=3D"mailto:j3@mailman.j3-fortran.org">j3@mailman.j3-fortran.org</a>&g=
t;<br><b>Reply-To: </b>j3 &lt;<a =
href=3D"mailto:j3@mailman.j3-fortran.org">j3@mailman.j3-fortran.org</a>&g=
t;<br><b>Date: </b>Tuesday, September 12, 2023 at 12:19 PM<br><b>To: =
</b>j3 &lt;<a =
href=3D"mailto:j3@mailman.j3-fortran.org">j3@mailman.j3-fortran.org</a>&g=
t;, WG5 &lt;<a =
href=3D"mailto:sc22wg5@open-std.org">sc22wg5@open-std.org</a>&gt;<br><b>C=
c: </b>Brad Richardson &lt;<a =
href=3D"mailto:everythingfunctional@protonmail.com">everythingfunctional@=
protonmail.com</a>&gt;<br><b>Subject: </b>[EXTERNAL] [BULK] [J3] =
[SC22WG5.6477] are race conditions allowed in do concurrent?</span><span =
lang=3DEN-US><o:p></o:p></span></p></div><div><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'mso-ligatures:none'>&nbsp;</span><span =
lang=3DEN-US><o:p></o:p></span></p></div><table class=3DMsoNormalTable =
border=3D1 cellspacing=3D0 cellpadding=3D0 align=3Dleft width=3D"100%" =
style=3D'width:100.0%;border:solid black 1.5pt'><tr><td width=3D"100%" =
style=3D'width:100.0%;border:none;background:#FFEB9C;padding:3.75pt =
3.75pt 3.75pt 3.75pt'><p class=3DMsoNormal =
style=3D'mso-element:frame;mso-element-frame-hspace:2.25pt;mso-element-wr=
ap:around;mso-element-anchor-vertical:paragraph;mso-element-anchor-horizo=
ntal:column;mso-height-rule:exactly'><b><span =
style=3D'font-size:10.0pt;color:black;mso-ligatures:none'>CAUTION:</span>=
</b><span style=3D'color:black;mso-ligatures:none'> </span><span =
style=3D'font-size:10.0pt;color:black;mso-ligatures:none'>This email =
originated from outside of NASA.&nbsp; Please take care when clicking =
links or opening attachments.&nbsp; Use the &quot;Report Message&quot; =
button to report suspicious messages to the NASA&nbsp;SOC.</span><span =
style=3D'color:black;mso-ligatures:none'> =
</span><o:p></o:p></p></td></tr></table><p class=3DMsoNormal =
style=3D'mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;mar=
gin-left:36.0pt'><span lang=3DEN-US =
style=3D'mso-ligatures:none'><br><br><br></span><span =
lang=3DEN-US><o:p></o:p></span></p><div><div><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'mso-ligatures:none'>Hi Jeff,</span><span =
lang=3DEN-US><o:p></o:p></span></p></div><div><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'mso-ligatures:none'>&nbsp;</span><span =
lang=3DEN-US><o:p></o:p></span></p></div><div><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'mso-ligatures:none'>Based on &quot; If it is defined or becomes =
undefined during any iteration, it shall not be referenced, defined, or =
become undefined during any other iteration.&quot;, the provide program =
is invalid, because `x` becomes defined in more than one =
iteration.</span><span lang=3DEN-US><o:p></o:p></span></p></div><div><p =
class=3DMsoNormal style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'mso-ligatures:none'>&nbsp;</span><span =
lang=3DEN-US><o:p></o:p></span></p></div><div><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'mso-ligatures:none'>The way I've heard &quot;definition&quot; =
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.</span><span =
lang=3DEN-US><o:p></o:p></span></p></div><div><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'mso-ligatures:none'>&nbsp;</span><span =
lang=3DEN-US><o:p></o:p></span></p></div><div><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'mso-ligatures:none'>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.</span><span =
lang=3DEN-US><o:p></o:p></span></p></div><div><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'mso-ligatures:none'>&nbsp;</span><span =
lang=3DEN-US><o:p></o:p></span></p></div><div><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'mso-ligatures:none'>Regards,</span><span =
lang=3DEN-US><o:p></o:p></span></p></div><div><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'mso-ligatures:none'>Brad</span><span =
lang=3DEN-US><o:p></o:p></span></p></div><div><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'mso-ligatures:none'>&nbsp;</span><span =
lang=3DEN-US><o:p></o:p></span></p></div><div><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'mso-ligatures:none'>On Tue, 2023-09-12 at 14:43 +0000, Jeff =
Hammond via J3 wrote:</span><span =
lang=3DEN-US><o:p></o:p></span></p></div><blockquote =
style=3D'border:none;border-left:solid #729FCF 1.5pt;padding:0cm 0cm 0cm =
6.0pt;margin-left:4.8pt;margin-right:0cm'><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:12.0pt'>Is this a legal program in Fortran with =
defined behavior?&nbsp; If it is illegal or the behavior is undefined, =
where do we say that?</span><span lang=3DEN-US><o:p></o:p></span></p><p =
class=3DMsoNormal style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp;</span><span =
lang=3DEN-US><o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:12.0pt'>program main</span><span =
lang=3DEN-US><o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp; integer :: k</span><span =
lang=3DEN-US><o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp; real :: x</span><span =
lang=3DEN-US><o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp; x =3D 0.0</span><span =
lang=3DEN-US><o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp; do concurrent (k=3D1:2) =
shared(x)</span><span lang=3DEN-US><o:p></o:p></span></p><p =
class=3DMsoNormal style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp;&nbsp;&nbsp; x =3D real(k)</span><span =
lang=3DEN-US><o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp; end do</span><span =
lang=3DEN-US><o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp; print*,x</span><span =
lang=3DEN-US><o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:12.0pt'>end program main</span><span =
lang=3DEN-US><o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp;</span><span =
lang=3DEN-US><o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:12.0pt'>Is that what the following is intended to =
do?</span><span lang=3DEN-US><o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp;</span><span =
lang=3DEN-US><o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:12.0pt'>=E2=80=9CIf 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.=E2=80=9D</span><span =
lang=3DEN-US><o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp;</span><span =
lang=3DEN-US><o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:12.0pt'>If so, then I am struggling to apply this to =
arrays.&nbsp; When we say a variable has shared locality, is the =
variable the array or the element?&nbsp; We can only put array names in =
SHARED(), but applying the text regarding =E2=80=9Cto become =
defined=E2=80=9D from the perspective of arrays appears to have =
interesting consequences.</span><span =
lang=3DEN-US><o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp;</span><span =
lang=3DEN-US><o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:12.0pt'>Thanks,</span><span =
lang=3DEN-US><o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:12.0pt'><br>Jeff</span><span =
lang=3DEN-US><o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp;</span><span =
lang=3DEN-US><o:p></o:p></span></p></blockquote><div><p =
class=3DMsoNormal style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'mso-ligatures:none'>&nbsp;</span><span =
lang=3DEN-US><o:p></o:p></span></p></div></div></blockquote><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'mso-ligatures:none'><o:p>&nbsp;</o:p></span></p></div></div></bo=
dy></html>
------=_NextPart_000_0030_01D9E714.6CC25EA0--

