From owner-sc22wg5+sc22wg5-dom9=www.open-std.org@open-std.org  Wed Sep 20 14:34:34 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 0E46A356A31; Wed, 20 Sep 2023 14:34:34 +0200 (CEST)
Delivered-To: sc22wg5@open-std.org
Received: from mail-ua1-f51.google.com (mail-ua1-f51.google.com [209.85.222.51])
	by www.open-std.org (Postfix) with ESMTP id 55504356969
	for <sc22wg5@open-std.org>; Wed, 20 Sep 2023 14:34:33 +0200 (CEST)
Received: by mail-ua1-f51.google.com with SMTP id a1e0cc1a2514c-7a52db1e4bbso2539977241.3
        for <sc22wg5@open-std.org>; Wed, 20 Sep 2023 05:34:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=lbl-gov.20230601.gappssmtp.com; s=20230601; t=1695213272; x=1695818072; darn=open-std.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=L0DKmTXOTZJoGgKS5wpyQJ1BSNl9JoGb+Yp0KTMFoPc=;
        b=WeCF/gg6sc1nOQu+eR5bgE92m5r6zypCgy9EHTNkUzvF7q7AaXmogZIuhlWlFreG+6
         WFue3zwEBAGt5WAHT/WUA5cBSAQVuudgYTeuTWe2eBPLKkVmDGgqD56iHgIOHnF03kHr
         t8NrlpeqEH3J+AeoztyaYSJ1GxZRJrEnDFVLUF+FwlELYtq0+dxSz3+xbhWpyMErHMeq
         vU5CARIl86nTEELJxjgQfF7g3bOeYdWKVtjaELT6Io8cXC8jobS3J0Z+Z0UP02VGhLNa
         z6xR3rU8j6YXFmzcgM1cO3nNJFar9VEiiLW3GJZCovSIZmsPu3gB6PiD+ED3+F4DL6Ys
         qtQw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1695213272; x=1695818072;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=L0DKmTXOTZJoGgKS5wpyQJ1BSNl9JoGb+Yp0KTMFoPc=;
        b=IUcQ+PZuSonyBzGU3JgEkhPF/5dZSEgcz/RLvD+7xqHXMDMRctBm1X8B/BmyXlBONi
         FGm0yr1Y3vo/I2OgWXvIGrnmWZI/4JZGDrGTmngt04AaQlnoihWBS6hB7l0Uq5wBu+eS
         xpijX2fo4lTWOp9qvDpJbTPZp5eWRNFxRR6JinPTUsamfQ+Rz91AcnH1+nqm7BGpZWxP
         mIw8jQdL8LI068348BGqrMNo3W+2QQHU3zsvIxWRP8pGMF6Dh9/oD1XNix/rMXbxT043
         Hf46ENftpLCfCRrCknGkoLz6Y2p8/4P/35kpXIBd6j+yhrVaxt4VycI9XimlwLz/lv0I
         ei5Q==
X-Gm-Message-State: AOJu0YzU8msUyVFksHuHDTStj1TYaA0UvO1CaQc0uikktXfb9nNCrNcB
	w1R937Hl3sA8sb+2jP7VacW30RqlvyoaUeSZniR1lr2FIFg4bcV9twFOB9oLKm6to64lysvj7pL
	BZPpBKqUSId+1uNrrlj2XKewtHAhSj6tVbkQe/YvvQXaWvaoQpAmhniKR+V+GSE3emu135JYRle
	j27NQVar4pGjW3h2C+
X-Google-Smtp-Source: AGHT+IESq7P/boILntoQ1mNOVOzwAFXDcrDFCS4AXGNbg+9qnQiM0AKyNHk0+L3eyh4MVLD3BcuwBJT3kN5Ahfj2yxk=
X-Received: by 2002:a1f:c6c1:0:b0:495:ec90:997e with SMTP id
 w184-20020a1fc6c1000000b00495ec90997emr2577290vkf.7.1695213271566; Wed, 20
 Sep 2023 05:34:31 -0700 (PDT)
MIME-Version: 1.0
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> <20230914051137.8F0F93569EF@www.open-std.org>
 <20230914132511.A9155356742@www.open-std.org> <20230919074924.5A64A356969@www.open-std.org>
 <20230919085702.1ECCF3569C0@www.open-std.org> <73963378-8AB0-447B-8BA0-EC90F07B0FEF@nasa.gov>
 <DM6PR12MB3130F647EF16E1D055CCD673CBFAA@DM6PR12MB3130.namprd12.prod.outlook.com>
 <20230920085704.D845D3569F4@www.open-std.org> <20230920093749.0462C3569FD@www.open-std.org>
 <DM6PR12MB3130828786A39BD24BA2D206CBF9A@DM6PR12MB3130.namprd12.prod.outlook.com>
In-Reply-To: <DM6PR12MB3130828786A39BD24BA2D206CBF9A@DM6PR12MB3130.namprd12.prod.outlook.com>
From: Damian Rouson <rouson@lbl.gov>
Date: Wed, 20 Sep 2023 08:34:20 -0400
Message-ID: <CAM2rSoXk6UbDCZmdtOT=E1iFOxF9S+1qErU44mn357y5HcA7BA@mail.gmail.com>
Subject: Re: [J3] Do Concurrent with unspecified locality, calling pure procedures
To: General J3 interest list <j3@mailman.j3-fortran.org>
Cc: Jeff Hammond <jehammond@nvidia.com>, WG5 <sc22wg5@open-std.org>, 
	Malcolm Cohen <malcolm@nag-j.co.jp>
Content-Type: multipart/alternative; boundary="000000000000df00290605c99827"
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

--000000000000df00290605c99827
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Thanks for pointing this out, Jeff.  This is a very important use case for
me.  Over the past ~3 years, I have evolved toward a pattern of writing
libraries in which nearly every procedure in the library is pure with one
of the motivations being that this guarantees that nearly every procedure
in the library can be called inside `do concurrent`.  Such a pattern is
especially important if the library code is likely to dominate the runtime
of the application that is using the library as I suspect will be the case
for some of the libraries that I spend the most time developing lately.

Damian

On Wed, Sep 20, 2023 at 6:29=E2=80=AFAM Jeff Hammond via J3 <
j3@mailman.j3-fortran.org> wrote:

> Can we add something about the fact that unspecified locality is nigh
> impossible when the code that is executed during the iteration is invisib=
le
> to the compiler due to a procedure call?
>
>
>
> If I take the Peter example and put the loop body in a pure procedure, I
> cannot see any way for the compiler to implement what we require there,
> which is that elements of T be localized whenever K=3DL (or the entire ar=
ray
> is localized).
>
>
> The alternative seems to be that procedure calls with arrays will disable
> parallelism unless the compile does whole-program analysis, possibly at
> link-time, to figure out what is defined or undefined by the procedure.
>
>
>
> I don=E2=80=99t expect us to solve this.  I=E2=80=99d just like to add th=
e commonsense
> thing that we all agree on, which is that unspecified locality is a
> terrible idea, and that it seems catastrophic in the case of procedure
> calls.
>
>
>
> module w
>
> interface
>
> pure subroutine bar(J,K,L,T,A,B)
>
>   implicit none
>
>   integer, intent(in) :: J, K, L
>
>   real, intent(in) :: A(:)
>
>   real, intent(out) :: B(:)
>
>   real, intent(inout) :: T(:)
>
>   ! the implementation, found elsewhere, does this:
>
>   ! T(K) =3D A(J)
>
>   ! B(J) =3D T(L)
>
> end subroutine bar
>
> end interface
>
> end module w
>
>
>
> subroutine foo(N, A, B, T, K, L)
>
>   use w
>
>   implicit none
>
>   integer, intent(in) :: N, K(N), L(N)
>
>   real, intent(in) :: A(N)
>
>   real, intent(out) :: B(N)
>
>   real, intent(inout) :: T(N)
>
>   do concurrent (integer :: J=3D1:N)
>
>     call bar(J,K(J),L(J),T,A,B)
>
>   end do
>
> end subroutine foo
>
>
>
> *From: *J3 <j3-bounces@mailman.j3-fortran.org> on behalf of Jeff Hammond
> via J3 <j3@mailman.j3-fortran.org>
> *Date: *Wednesday, 20. September 2023 at 12.37
> *To: *General J3 interest list <j3@mailman.j3-fortran.org>
> *Cc: *Jeff Hammond <jehammond@nvidia.com>, WG5 <sc22wg5@open-std.org>,
> Malcolm Cohen <malcolm@nag-j.co.jp>
> *Subject: *[J3] [SC22WG5.6491] RE: [EXTERNAL] [BULK] Subobject of a
> variable
>
> *External email: Use caution opening links or attachments*
>
>
>
> Thanks, I have been slowly coming around to a similar conclusion, which i=
s
> that Do Concurrent means =E2=80=9Cin any order=E2=80=9D plus =E2=80=9Cuse=
r hints that
> auto-parallelization is desirable=E2=80=9D, which is to say, Do Concurren=
t may only
> be mapped to =E2=80=9C!$omp parallel do" conditionally, after the compile=
r has
> proven that the loop is legal to auto-parallelize.
>
>
>
> In this interpretation, Concurrent is still quite powerful, because it
> gives the user a way to strongly encourage auto-parallelization, when
> compilers may not otherwise do so aggressively because auto-parallelizati=
on
> all Do loops that are legal to do so with threads is likely to hurt
> performance, because thread overhead is nontrivial.  This should lead to
> high-quality implementations of auto-parallelization (as I know Damian an=
d
> friends want) and sequential behavior only in pathological cases that mos=
t
> people aren=E2=80=99t writing.
>
>
>
> It may interest some to know that yesterday during the OpenMP meeting, we
> decided to settle the problem of =E2=80=9C!$omp loop=E2=80=9D on Do Concu=
rrent by adding a
> restriction that users must specify the locality of variables that will b=
e
> written to in more than one iteration.  This means that, in the context o=
f
> OpenMP, Peter=E2=80=99s problematic example becomes erroneous unless the =
programmer
> adds shared() appropriately, as you and Damian both suggest is the
> resolution to this.
>
>
>
> Anyways, our implementation likely requires very little change to reflect
> this, since Do Concurrent can be implemented with OpenACC =E2=80=9Ckernel=
s=E2=80=9D, which
> causes the compiler to do auto-parallelization, based on what it can prov=
e
> is possible.  I imagine that Intel will have to do more work, to disable
> parallelism when it=E2=80=99s not legal.
>
>
>
> Jeff
>
>
>
>
>
> On 20. Sep 2023, at 11.56, Malcolm Cohen via J3 <j3@mailman.j3-fortran.or=
g>
> wrote:
>
>
>
> *External email: Use caution opening links or attachments*
>
>
>
> Hi Jeff,
>
>
>
> The other side of a variable being =E2=80=9Cundefined=E2=80=9D is =E2=80=
=9Chaving a specific
> value=E2=80=9D.
>
>
>
> No-one would expect that having a specific value propagates to subobjects
> (the rank or type would be different).
>
>
>
> > It is hard for me to understand how I can apply the locality inference
> rules when the inferred locality propagates, but the rules used for that
> inference don=E2=80=99t.
>
>
>
> Rules don=E2=80=99t =E2=80=9Cpropagate=E2=80=9D. Rules are rules.
>
>
>
> I do not see anything odd about =E2=80=9CIf I define the whole of array X=
 in an
> iteration, no other iteration can define the whole of array X=E2=80=9D an=
d =E2=80=9CIf I
> define an element of the array X in an iteration, no other iteration can
> define that element of X=E2=80=9D.
>
>
>
> Perhaps it might help to think that DO CONCURRENT is not in fact a
> variation of OpenMP !$OMP DO. That is not how it came about. DO CONCURREN=
T
> is two things:
>
>    1. A reworking of FORALL to remove the plethora of array temps that
>    FORALL often mandates.
>    2. A standardised form of the directive =E2=80=9C!DEC$IVDEP=E2=80=9D (=
I probably have
>    that spelled wrong =E2=80=93 the manuals are in the office.) This dire=
ctive
>    declares that the loop iterations are independent, and that enables va=
rious
>    useful loop optimisations, like software pipelining and so on.
>
>
>
> Now, in the =E2=80=9Csimple=E2=80=9D cases (and there are a lot of simple=
 cases), it can
> be easy to parallelise a DO CONCURRENT as originally designed (F2008), vi=
z
> with everything =E2=80=9Cunspecified locality=E2=80=9D, but although para=
llelisability was
> a strong consideration, it was not the driving force behind the original
> design.
>
>
>
> The drawbacks of unspecified locality re parallelisation are what lead to
> the introduction of specified locality in F2018.
>
>
>
> Seriously, users wanting good performance should not be using unspecified
> locality, except perhaps in the simplest of loops. Actually, with my
> Software Engineering hat on, I=E2=80=99d say users should not be using un=
specified
> locality ever, they should tell the compiler **and subsequent
> readers/maintainers of the code** what they want explicitly.
>
>
>
> And for the compiler, if it cannot work out what the locality of some
> variable is, it should just execute the loop serially (in any order). Tha=
t
> will always give the correct answer, because loop iterations are
> independent (well, the user claimed they were, anyway), and do not depend
> of what the locality actually is. (If a =E2=80=9Cparallelise DO CONCURREN=
T=E2=80=9D option
> is active, it might be a good idea to produce a warning when this happens=
.)
>
>
>
> Anecdote: When I explained DO CONCURRENT to some OpenMP programmers, they
> were aghast. =E2=80=9CDo not ever execute it in parallel!=E2=80=9D was th=
eir response, with
> the explanation =E2=80=9CIf we want a loop executed in parallel we will u=
se !$OMP
> PARALLEL DO, if the compiler might create threads on any other loop, that
> would be excessive threads and would slow down the overall execution due =
to
> thread contention for resources.=E2=80=9D
>
>
>
> Cheers,
>
> --
>
> ..............Malcolm Cohen, NAG Oxford/Tokyo.
>
>
>
> *From:* J3 <j3-bounces@mailman.j3-fortran.org> *On Behalf Of *Jeff
> Hammond via J3
> *Sent:* Tuesday, September 19, 2023 10:59 PM
> *To:* Clune, Thomas L. (GSFC-6101) <thomas.l.clune@nasa.gov>; General J3
> interest list <j3@mailman.j3-fortran.org>
> *Cc:* Jeff Hammond <jehammond@nvidia.com>; WG5 <sc22wg5@open-std.org>;
> Malcolm Cohen <malcolm@nag-j.co.jp>
> *Subject:* [J3] [SC22WG5.6488] [EXTERNAL] [BULK] Subobject of a variable
>
>
>
> Okay, but we are saying that, in the context of do concurrent, locality
> obviously propagates to subobjects, but (un)definedness obviously doesn=
=E2=80=99t.
>
>
>
> This bothers me because we use (un)definedness to infer the locality of
> variables with unspecified locality.  It is hard for me to understand how=
 I
> can apply the locality inference rules when the inferred locality
> propagates, but the rules used for that inference don=E2=80=99t.
>
>
>
> Jeff
>
>
>
> *From: *Clune, Thomas L. (GSFC-6101) <thomas.l.clune@nasa.gov>
> *Date: *Tuesday, 19. September 2023 at 16.17
> *To: *General J3 interest list <j3@mailman.j3-fortran.org>
> *Cc: *Jeff Hammond <jehammond@nvidia.com>, WG5 <sc22wg5@open-std.org>,
> Malcolm Cohen <malcolm@nag-j.co.jp>
> *Subject: *Re: [EXTERNAL] [BULK] [J3] [SC22WG5.6486] Subobject of a
> variable
>
> *External email: Use caution opening links or attachments*
>
>
>
> I do not find this situation odd.    Lots of things don=E2=80=99t propaga=
te to
> subobjects.      E.g., if an array is allocatable, it=E2=80=99s elements =
are not.
> If an array is pointer, it=E2=80=99s elements are not.
>
>
>
> And =E2=80=9Cundefinedness=E2=80=9D is very much a property of subobjects=
.   Indeed, a
> variable is only defined if all of its subobjects are defined.  (I hope I
> have that right.)
>
>
>
>    - Tom
>
>
>
> *From: *J3 <j3-bounces@mailman.j3-fortran.org> on behalf of j3 <
> j3@mailman.j3-fortran.org>
> *Reply-To: *j3 <j3@mailman.j3-fortran.org>
> *Date: *Tuesday, September 19, 2023 at 4:57 AM
> *To: *j3 <j3@mailman.j3-fortran.org>
> *Cc: *Jeff Hammond <jehammond@nvidia.com>, WG5 <sc22wg5@open-std.org>,
> Malcolm Cohen <malcolm@nag-j.co.jp>
> *Subject: *[EXTERNAL] [BULK] [J3] [SC22WG5.6486] Subobject of a variable
>
>
>
> *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.
>
>
>
>
> If a variable has unspecified locality,
>
> - if it is referenced in an iteration it shall either be previously
> defined during that iteration, or shall not be defined or become undefine=
d
> during any other iteration; if it is defined or becomes undefined by more
> than one iteration it becomes undefined when the loop terminates;
>
> real, dimension(10) :: A
>
>
>
> do concurrent (integer :: k=3D1:size(A))
>
>   A(k) =3D k
>
>   if (k.eq.1) A(10) =3D 0
>
> end do
>
>
>
> As best I can tell, A(1:9) are defined after the loop terminates, while
> A(10) and A are not.  Does the fact that A is undefined before and become=
s
> undefined during this loop imply anything about the undefined-ness of its
> elements during the loop or must one reason about them strictly
> independently, based on the element-wise defined/undefined-ness?
>
>
>
> Now suppose I make A shared.  Malcolm said all the elements of A are
> shared as well "It=E2=80=99s not written there now, because, like, how co=
uld it
> possibly be anything else?=E2=80=9D
>
>
>
> real, dimension(10) :: A
>
>
>
> do concurrent (integer :: k=3D1:size(A)) shared(A)
>
>   A(k) =3D k
>
>   if (k.eq.1) A(10) =3D 0
>
> end do
>
>
>
> It is odd to me that the shared-ness of A propagates to its elements but
> the undefined-ness does not.  Why must I reason about the element-wise
> behavior of an array independent of the array itself when worrying about
> whether a variable becomes undefined or defined during a loop, but in the
> same context, they are obviously not independent regarding locality?
>
>
>
> Jeff
>
>
>
>
>
>
> On 19. Sep 2023, at 10.49, Malcolm Cohen via J3 <j3@mailman.j3-fortran.or=
g>
> wrote:
>
>
>
> *External email: Use caution opening links or attachments*
>
>
>
> Hi Brad,
>
>
>
> There is no doubt that subobject includes array elements.
>
>
>
> The point is that a subobject of a variable is itself a variable. So
> nothing more needs to be said on that front.
>
>
>
> But in the case of a subobject of a constant, that is often not constant.
> E.g.
>
>    INTEGER,PARAMETER :: x(10) =3D [ 1,2,3,4,5,6,7,8,9,10 ]
>
>    READ *,I
>
>    PRINT *,x(I)
>
>
>
> Here, X(I) is not a variable, and is also not a constant. It is a
> non-constant subobject of a constant!
>
>
>
> That is what those words are there for. They are not intended to imply
> that subobjects of a variable are not data objects. They are simply becau=
se
> they are also variables, indeed, portions that can be defined and redefin=
ed
> separately, and being capable of being defined and redefined makes them
> variables.
>
>
>
> We could add a NOTE to say that =E2=80=9CA subobject of a variable is a v=
ariable,
> but a subobject of a constant is not necessarily itself constant, e.g. if
> it has a non-constant subscript.=E2=80=9D Not sure it is really worth it =
though, at
> least, not until we decide what to do with our overly-large set of terms.
>
>
>
> Cheers,
>
> --
>
> ..............Malcolm Cohen, NAG Oxford/Tokyo.
>
>
>
> *From:* Brad Richardson <everythingfunctional@protonmail.com>
> *Sent:* Thursday, September 14, 2023 10:25 PM
> *To:* General J3 interest list <j3@mailman.j3-fortran.org>; 'WG5' <
> sc22wg5@open-std.org>
> *Subject:* [ukfortran] [SC22WG5.6484] [J3] RE: [EXTERNAL] [BULK] are race
> conditions allowed in do concurrent?
>
>
>
> Hi Malcolm,
>
>
>
> > >variable/data entity/data object
>
> > >[are] circular, and doesn't seem to include individual array elements
>
>
>
> > Yes it does, see 3.138 subobject.
>
>
>
> While I see that it probably intends to include it, what it actually says
> is
>
>
>
> subobject of a constant
>
>
>
> so the edit would be to change it to
>
>
>
> subobject of a variable or constant
>
>
>
> I don't think the circularity is causing too much confusion, so I don't
> see much urgency in trying to fix it, and don't quite see an easy way to =
do
> so. I think we can leave it for now.
>
>
>
> Regards,
>
> Brad
>
>
>
> On Thu, 2023-09-14 at 14:04 +0900, Malcolm Cohen via J3 wrote:
>
> Hi Brad,
>
>
>
> There is no contradiction, subtle or otherwise, here.
>
>
>
> Locality-specs are only for named variables. However, as noted, subobject=
s
> of variables are also variables.
>
>
>
> > 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,
>
>
>
> 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.
>
>
>
> I can see some potential wording improvements for the next revision, but
> nothing that rises to the level of a defect.
>
>
>
> E.g. it may be better to mention that =E2=80=9Cif a variable has SHARED l=
ocality,
> all of its subobjects have SHARED locality=E2=80=9D. It=E2=80=99s not wri=
tten 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 writi=
ng
> =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.
>
>
>
> >variable/data entity/data object
>
> >[are] circular, and doesn't seem to include individual array elements
>
>
>
> Yes it does, see 3.138 subobject.
>
>
>
> The circularity is unfortunate, but they are all reasonably worded for
> comprehensibility (not for trail-following). So it=E2=80=99s either delet=
ing 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 wh=
y it is
> still like this).
>
>
>
> If it were a glossary of terms, instead of a list of definitions, there
> would be no problem with circularity, right?
>
>
>
> 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.
>
>
>
> Given our experience this time around, I would be in favour of pruning ou=
r
> terms and definitions, down to a more minimal set. If there are =E2=80=9C=
useful=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 (o=
f =E2=80=9Cuseful terms=E2=80=9D,
> but probably better not to call them =E2=80=9Cterms=E2=80=9D!).
>
>
>
> Cheers,
>
> --
>
> ..............Malcolm Cohen, NAG Oxford/Tokyo.
>
>
>
> *From:* Brad Richardson <everythingfunctional@protonmail.com>
> *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?
>
>
>
> Hmm... I decided to work through this a bit more thoroughly.
>
>
>
> From the syntax definitions:
>
>
>
> R902
>
> variable
>
> is designator
>
> or function-reference
>
>
>
> R901
>
> designator
>
> is object-name
>
> or array-element
>
> or array-section
>
> or coindexed-named-object
>
> or complex-part-designator
>
> or structure-component
>
> or substring
>
>
>
>
>
> Ok, so according to the syntax an array element is a variable.
>
>
>
> From the terms and definitions:
>
>
>
> variable
>
> data entity (3.41) that can be defined (3.48) and redefined during
> execution of a program
>
>
>
> data entity
>
> data object (3.42), result of the evaluation of an expression, or the
> result of the execution of a function reference
>
>
>
> data object
>
> constant, variable, or subobject of a constant
>
>
>
> which is circular, and doesn't seem to include individual array elements.
>
>
>
> So now the question is which "definition" does the DO CONCURRENT
> constraint refer to?
>
>
>
> From the syntax definitions:
>
>
>
> R1129
>
> concurrent-locality
>
> is
>
> [ locality-spec ]...
>
>
>
> 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 )
>
>
>
> only allows variable-name, not designator, so it's not exactly clear.
>
>
>
> The "constraint" appears in normative text, I.e.
>
>
>
> If a variable has
>
>
>
> which is not hyperlinked and is not in a font indicating reference to the
> syntax term.
>
>
>
> 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 separat=
e
> iterations, but not valid to (un)define and reference the same element of
> an array in separate iterations.
>
>
>
> I think it would be worth "fixing" the terms and definitions to eliminate
> the circular definition and make it consistent with the syntax.
>
>
>
> Regards,
>
> Brad
>
>
>
> 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:     <var=
iable>   <<is>>
> <designator> <<or>> <function-reference>
>
>
>
> And <designator> includes <array-element>.
>
>
>
> But I for one would not mind an explanatory note that clarifies the commo=
n
> use case of array elements in this context.
>
>
>
>
>
>
>
> *From:*J3 <j3-bounces@mailman.j3-fortran.org> on behalf of j3 <
> j3@mailman.j3-fortran.org>
> *Reply-To: *j3 <j3@mailman.j3-fortran.org>
> *Date: *Tuesday, September 12, 2023 at 12:19 PM
> *To: *j3 <j3@mailman.j3-fortran.org>, WG5 <sc22wg5@open-std.org>
> *Cc: *Brad Richardson <everythingfunctional@protonmail.com>
> *Subject: *[EXTERNAL] [BULK] [J3] [SC22WG5.6477] are race conditions
> allowed in do concurrent?
>
>
>
> *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.
>
>
>
>
>
>
>
> 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 a=
n
> element of an array does not constitute definition of the variable, becau=
se
> it is then only partially defined. I.e. an array is only defined once eac=
h
> 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 =3D 0.0
>
>   do concurrent (k=3D1:2) shared(x)
>
>     x =3D real(k)
>
>   end do
>
>   print*,x
>
> end program main
>
>
>
> Is that what the following is intended to do?
>
>
>
> =E2=80=9CIf a variable has SHARED locality, appearances of the variable w=
ithin the
> DO CONCURRENT construct refer to the variable in the innermost executable
> construct or scoping unit that includes the DO CONCURRENT construct. If i=
t
> is defined or becomes undefined during any iteration, it shall not be
> referenced, defined, or become undefined during any other iteration.=E2=
=80=9D
>
>
>
> 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 in=
teresting
> consequences.
>
>
>
> Thanks,
>
>
> Jeff
>
>
>

--000000000000df00290605c99827
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">Thanks for pointing this out, Jeff.=C2=A0=
 This is a very important use case for me.=C2=A0 Over the past ~3 years, I =
have evolved toward a pattern of writing libraries in which nearly every pr=
ocedure in the library is pure with one of the motivations being that this =
guarantees that nearly every procedure in the library can be called inside =
`do concurrent`.=C2=A0 Such a pattern is especially important if the librar=
y code is likely to dominate the runtime of the application that is using t=
he library as I suspect will be the case for some of the libraries that I s=
pend the most time developing=C2=A0lately.</div><div dir=3D"ltr"><br></div>=
<div>Damian</div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"g=
mail_attr">On Wed, Sep 20, 2023 at 6:29=E2=80=AFAM Jeff Hammond via J3 &lt;=
<a href=3D"mailto:j3@mailman.j3-fortran.org">j3@mailman.j3-fortran.org</a>&=
gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0=
px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-colo=
r:rgb(204,204,204);padding-left:1ex"><div class=3D"msg285804370083146095">





<div lang=3D"en-FI" style=3D"line-break:after-white-space">
<div class=3D"m_7215615541851461404WordSection1">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">Can we=
 add something about the fact that unspecified locality is nigh impossible =
when the code that is executed during the iteration is invisible to the com=
piler due to a procedure call?<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt"><u></u=
>=C2=A0<u></u></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">If I t=
ake the Peter example and put the loop body in a pure procedure, I cannot s=
ee any way for the compiler to implement what we require there, which is th=
at elements of T be localized whenever
 K=3DL (or the entire array is localized).<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt"><br>
The alternative seems to be that procedure calls with arrays will disable p=
arallelism unless the compile does whole-program analysis, possibly at link=
-time, to figure out what is defined or undefined by the procedure.<u></u><=
u></u></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt"><u></u=
>=C2=A0<u></u></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">I don=
=E2=80=99t expect us to solve this.=C2=A0 I=E2=80=99d just like to add the =
commonsense thing that we all agree on, which is that unspecified locality =
is a terrible idea, and that it seems catastrophic in the
 case of procedure calls.<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt"><u></u>=C2=A0<u></u><=
/span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">module w<u></u><u></u=
></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">interface<u></u><u></=
u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">pure subroutine bar(J=
,K,L,T,A,B)<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">=C2=A0 implicit none<=
u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">=C2=A0 integer, inten=
t(in) :: J, K, L<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">=C2=A0 real, intent(i=
n) :: A(:)<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">=C2=A0 real, intent(o=
ut) :: B(:)<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">=C2=A0 real, intent(i=
nout) :: T(:)<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">=C2=A0 ! the implemen=
tation, found elsewher</span><span lang=3D"EN-US" style=3D"font-size:12pt">=
e</span><span style=3D"font-size:12pt">, does this:<u></u><u></u></span></p=
>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">=C2=A0 ! T(K) =3D A(J=
)<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">=C2=A0 ! B(J) =3D T(L=
)<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">end subroutine bar<u>=
</u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">end interface<u></u><=
u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">end module w<u></u><u=
></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt"><u></u>=C2=A0<u></u><=
/span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">subroutine foo(N, A, =
B, T, K, L)<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">=C2=A0 use w<u></u><u=
></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">=C2=A0 implicit none<=
u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">=C2=A0 integer, inten=
t(in) :: N, K(N), L(N)<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">=C2=A0 real, intent(i=
n) :: A(N)<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">=C2=A0 real, intent(o=
ut) :: B(N)<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">=C2=A0 real, intent(i=
nout) :: T(N)<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">=C2=A0 do concurrent =
(integer :: J=3D1:N)<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">=C2=A0=C2=A0=C2=A0 ca=
ll bar(J,K(J),L(J),T,A,B)<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">=C2=A0 end do<u></u><=
u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">end subroutine foo<u>=
</u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt"><u></u>=C2=A0<u></u><=
/span></p>
<div id=3D"m_7215615541851461404mail-editor-reference-message-container">
<div>
<div style=3D"border-style:solid none none;border-top-width:1pt;border-top-=
color:rgb(181,196,223);padding:3pt 0cm 0cm">
<p class=3D"MsoNormal" style=3D"margin-bottom:12pt"><b><span style=3D"font-=
size:12pt;color:black">From:
</span></b><span style=3D"font-size:12pt;color:black">J3 &lt;<a href=3D"mai=
lto:j3-bounces@mailman.j3-fortran.org" target=3D"_blank">j3-bounces@mailman=
.j3-fortran.org</a>&gt; on behalf of Jeff Hammond via J3 &lt;<a href=3D"mai=
lto:j3@mailman.j3-fortran.org" target=3D"_blank">j3@mailman.j3-fortran.org<=
/a>&gt;<br>
<b>Date: </b>Wednesday, 20. September 2023 at 12.37<br>
<b>To: </b>General J3 interest list &lt;<a href=3D"mailto:j3@mailman.j3-for=
tran.org" target=3D"_blank">j3@mailman.j3-fortran.org</a>&gt;<br>
<b>Cc: </b>Jeff Hammond &lt;<a href=3D"mailto:jehammond@nvidia.com" target=
=3D"_blank">jehammond@nvidia.com</a>&gt;, WG5 &lt;<a href=3D"mailto:sc22wg5=
@open-std.org" target=3D"_blank">sc22wg5@open-std.org</a>&gt;, Malcolm Cohe=
n &lt;<a href=3D"mailto:malcolm@nag-j.co.jp" target=3D"_blank">malcolm@nag-=
j.co.jp</a>&gt;<br>
<b>Subject: </b>[J3] [SC22WG5.6491] RE: [EXTERNAL] [BULK] Subobject of a va=
riable<u></u><u></u></span></p>
</div>
<table border=3D"1" cellpadding=3D"0" style=3D"background-color:rgb(255,235=
,156)">
<tbody>
<tr>
<td style=3D"padding:0.75pt">
<p class=3D"MsoNormal"><b><span style=3D"font-size:7.5pt;font-family:Verdan=
a,sans-serif;color:black">External email: Use caution opening links or atta=
chments</span></b><span style=3D"font-size:7.5pt;font-family:Verdana,sans-s=
erif;color:black">
</span><span style=3D"font-size:11pt"><u></u><u></u></span></p>
</td>
</tr>
</tbody>
</table>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt"><u></u>=C2=A0<u></u><=
/span></p>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">Thanks, I have been s=
lowly coming around to a similar conclusion, which is that Do Concurrent me=
ans =E2=80=9Cin any order=E2=80=9D plus =E2=80=9Cuser hints that auto-paral=
lelization is desirable=E2=80=9D, which is to say, Do Concurrent may
 only be mapped to =E2=80=9C!$omp parallel do&quot; conditionally, after th=
e compiler has proven that the loop is legal to auto-parallelize.
<u></u><u></u></span></p>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt"><u></u>=C2=A0<u></u><=
/span></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">In this interpretatio=
n, Concurrent is still quite powerful, because it gives the user a way to s=
trongly encourage auto-parallelization, when compilers may not otherwise do=
 so aggressively because auto-parallelization
 all Do loops that are legal to do so with threads is likely to hurt perfor=
mance, because thread overhead is nontrivial.=C2=A0 This should lead to hig=
h-quality implementations of auto-parallelization (as I know Damian and fri=
ends want) and sequential behavior only
 in pathological cases that most people aren=E2=80=99t writing. <u></u><u><=
/u></span></p>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt"><u></u>=C2=A0<u></u><=
/span></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">It may interest some =
to know that yesterday during the OpenMP meeting, we decided to settle the =
problem of =E2=80=9C!$omp loop=E2=80=9D on Do Concurrent by adding a restri=
ction that users must specify the locality of variables
 that will be written to in more than one iteration.=C2=A0 This means that,=
 in the context of OpenMP, Peter=E2=80=99s problematic example becomes erro=
neous unless the programmer adds shared() appropriately, as you and Damian =
both suggest is the resolution to this.<u></u><u></u></span></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt"><u></u>=C2=A0<u></u><=
/span></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">Anyways, our implemen=
tation likely requires very little change to reflect this, since Do Concurr=
ent can be implemented with OpenACC =E2=80=9Ckernels=E2=80=9D, which causes=
 the compiler to do auto-parallelization, based on
 what it can prove is possible.=C2=A0 I imagine that Intel will have to do =
more work, to disable parallelism when it=E2=80=99s not legal.<u></u><u></u=
></span></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt"><u></u>=C2=A0<u></u><=
/span></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">Jeff<u></u><u></u></s=
pan></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt"><u></u>=C2=A0<u></u><=
/span></p>
<div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt"><br>
<br>
<u></u><u></u></span></p>
<blockquote style=3D"margin-top:5pt;margin-bottom:5pt">
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">On 20. Sep 2023, at 1=
1.56, Malcolm Cohen via J3 &lt;<a href=3D"mailto:j3@mailman.j3-fortran.org"=
 target=3D"_blank">j3@mailman.j3-fortran.org</a>&gt; wrote:<u></u><u></u></=
span></p>
</div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt"><u></u>=C2=A0<u></u><=
/span></p>
<div>
<table border=3D"1" cellpadding=3D"0" style=3D"background-color:rgb(255,235=
,156);word-spacing:0px">
<tbody>
<tr>
<td style=3D"padding:0.75pt">
<p class=3D"MsoNormal"><b><span style=3D"font-size:7.5pt;font-family:Verdan=
a,sans-serif;color:black">External email: Use caution opening links or atta=
chments</span></b><span style=3D"font-size:11pt;font-family:Helvetica"><u><=
/u><u></u></span></p>
</td>
</tr>
</tbody>
</table>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt"><u></u>=C2=A0<u></u><=
/span></p>
<div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">Hi Jeff,</span><u></u=
><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">=C2=A0</span><u></u><=
u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">The other side of a v=
ariable being =E2=80=9Cundefined=E2=80=9D is =E2=80=9Chaving a specific val=
ue=E2=80=9D.</span><u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">=C2=A0</span><u></u><=
u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">No-one would expect t=
hat having a specific value propagates to subobjects (the rank or type woul=
d be different).</span><u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">=C2=A0</span><u></u><=
u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">&gt;</span><span clas=
s=3D"m_7215615541851461404apple-converted-space"><span style=3D"font-size:1=
2pt">=C2=A0</span></span><span lang=3D"EN-US" style=3D"font-size:12pt">It i=
s hard for me to understand how I can apply the locality inference
 rules when the inferred locality propagates, but the rules used for that i=
nference don=E2=80=99t.</span><u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">=C2=A0=
</span><u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">Rules =
don=E2=80=99t =E2=80=9Cpropagate=E2=80=9D. Rules are rules.</span><u></u><u=
></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">=C2=A0=
</span><u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">I do n=
ot see anything odd about =E2=80=9CIf I define the whole of array X in an i=
teration, no other iteration can define the whole of array X=E2=80=9D and =
=E2=80=9CIf I define an element of the array X in an iteration,
 no other iteration can define that element of X=E2=80=9D.</span><u></u><u>=
</u></p>
</div>
<div>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">=C2=A0=
</span><u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">Perhap=
s it might help to think that DO CONCURRENT is not in fact a variation of O=
penMP !$OMP DO. That is not how it came about. DO CONCURRENT is two things:=
</span><u></u><u></u></p>
</div>
<ol style=3D"margin-top:0cm" start=3D"1" type=3D"1">
<li class=3D"m_7215615541851461404MsoListParagraph" style=3D"margin-top:0cm=
;margin-bottom:0cm">
A reworking of FORALL to remove the plethora of array temps that FORALL oft=
en mandates.<span style=3D"font-size:10pt"><u></u><u></u></span></li><li cl=
ass=3D"m_7215615541851461404MsoListParagraph" style=3D"margin-top:0cm;margi=
n-bottom:0cm">
A standardised form of the directive =E2=80=9C!DEC$IVDEP=E2=80=9D (I probab=
ly have that spelled wrong =E2=80=93 the manuals are in the office.) This d=
irective declares that the loop iterations are independent, and that enable=
s various useful loop optimisations, like software pipelining
 and so on.<span style=3D"font-size:10pt"><u></u><u></u></span></li></ol>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">=C2=A0</span><u></u><=
u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">Now, in the =E2=80=9C=
simple=E2=80=9D cases (and there are a lot of simple cases), it can be easy=
 to parallelise a DO CONCURRENT as originally designed (F2008), viz with ev=
erything =E2=80=9Cunspecified locality=E2=80=9D, but although parallelisabi=
lity
 was a strong consideration, it was not the driving force behind the origin=
al design.</span><u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">=C2=A0</span><u></u><=
u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">The drawbacks of unsp=
ecified locality re parallelisation are what lead to the introduction of sp=
ecified locality in F2018.</span><u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">=C2=A0</span><u></u><=
u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">Seriously, users want=
ing good performance should not be using unspecified locality, except perha=
ps in the simplest of loops. Actually, with my Software Engineering hat on,=
 I=E2=80=99d say users should not be using
 unspecified locality ever, they should tell the compiler *<b>and subsequen=
t readers/maintainers of the code</b>* what they want explicitly.</span><u>=
</u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">=C2=A0</span><u></u><=
u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">And for the compiler,=
 if it cannot work out what the locality of some variable is, it should jus=
t execute the loop serially (in any order). That will always give the corre=
ct answer, because loop iterations
 are independent (well, the user claimed they were, anyway), and do not dep=
end of what the locality actually is. (If a =E2=80=9Cparallelise DO CONCURR=
ENT=E2=80=9D option is active, it might be a good idea to produce a warning=
 when this happens.)</span><u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">=C2=A0</span><u></u><=
u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">Anecdote: When I expl=
ained DO CONCURRENT to some OpenMP programmers, they were aghast. =E2=80=9C=
Do not ever execute it in parallel!=E2=80=9D was their response, with the e=
xplanation =E2=80=9CIf we want a loop executed in parallel
 we will use !$OMP PARALLEL DO, if the compiler might create threads on any=
 other loop, that would be excessive threads and would slow down the overal=
l execution due to thread contention for resources.=E2=80=9D</span><u></u><=
u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">=C2=A0</span><u></u><=
u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">Cheers,</span><u></u>=
<u></u></p>
</div>
<div>
<p class=3D"MsoNormal" style=3D"text-align:justify"><span lang=3D"EN-US" st=
yle=3D"font-size:10.5pt">--</span><u></u><u></u></p>
<p class=3D"MsoNormal" style=3D"text-align:justify"><span lang=3D"EN-US" st=
yle=3D"font-size:10.5pt">..............Malcolm Cohen, NAG Oxford/Tokyo.</sp=
an><u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt">=C2=A0</span><u></u><=
u></u></p>
</div>
<div>
<div style=3D"border-style:solid none none;border-top-width:1pt;padding:3pt=
 0cm 0cm;border-color:currentcolor">
<div>
<p class=3D"MsoNormal"><b><span style=3D"font-size:11pt">From:</span></b><s=
pan class=3D"m_7215615541851461404apple-converted-space"><span style=3D"fon=
t-size:11pt">=C2=A0</span></span><span style=3D"font-size:11pt">J3 &lt;<a h=
ref=3D"mailto:j3-bounces@mailman.j3-fortran.org" target=3D"_blank">j3-bounc=
es@mailman.j3-fortran.org</a>&gt;<span class=3D"m_7215615541851461404apple-=
converted-space">=C2=A0</span><b>On
 Behalf Of<span class=3D"m_7215615541851461404apple-converted-space">=C2=A0=
</span></b>Jeff Hammond via J3<br>
<b>Sent:</b><span class=3D"m_7215615541851461404apple-converted-space">=C2=
=A0</span>Tuesday, September 19, 2023 10:59 PM<br>
<b>To:</b><span class=3D"m_7215615541851461404apple-converted-space">=C2=A0=
</span>Clune, Thomas L. (GSFC-6101) &lt;<a href=3D"mailto:thomas.l.clune@na=
sa.gov" target=3D"_blank">thomas.l.clune@nasa.gov</a>&gt;; General J3 inter=
est list &lt;<a href=3D"mailto:j3@mailman.j3-fortran.org" target=3D"_blank"=
>j3@mailman.j3-fortran.org</a>&gt;<br>
<b>Cc:</b><span class=3D"m_7215615541851461404apple-converted-space">=C2=A0=
</span>Jeff Hammond &lt;<a href=3D"mailto:jehammond@nvidia.com" target=3D"_=
blank">jehammond@nvidia.com</a>&gt;; WG5 &lt;<a href=3D"mailto:sc22wg5@open=
-std.org" target=3D"_blank">sc22wg5@open-std.org</a>&gt;; Malcolm Cohen &lt=
;<a href=3D"mailto:malcolm@nag-j.co.jp" target=3D"_blank">malcolm@nag-j.co.=
jp</a>&gt;<br>
<b>Subject:</b><span class=3D"m_7215615541851461404apple-converted-space">=
=C2=A0</span>[J3] [SC22WG5.6488] [EXTERNAL] [BULK] Subobject of a variable<=
/span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<p class=3D"MsoNormal">=C2=A0<u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">Okay, =
but we are saying that, in the context of do concurrent, locality obviously=
 propagates to subobjects, but (un)definedness obviously doesn=E2=80=99t.</=
span><u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">=C2=A0=
</span><u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">This b=
others me because we use (un)definedness to infer the locality of variables=
 with unspecified locality.=C2=A0 It is hard for me to understand how I can=
 apply the locality inference rules when
 the inferred locality propagates, but the rules used for that inference do=
n=E2=80=99t.</span><u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">=C2=A0=
</span><u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">Jeff</=
span><u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:12pt">=C2=A0</span><u></u><=
u></u></p>
</div>
<div id=3D"m_7215615541851461404mail-editor-reference-message-container">
<div>
<div style=3D"border-style:solid none none;border-top-width:1pt;padding:3pt=
 0cm 0cm;border-color:currentcolor">
<p class=3D"MsoNormal" style=3D"margin-bottom:12pt"><b><span lang=3D"EN-US"=
 style=3D"font-size:12pt">From:<span class=3D"m_7215615541851461404apple-co=
nverted-space">=C2=A0</span></span></b><span lang=3D"EN-US" style=3D"font-s=
ize:12pt">Clune, Thomas L. (GSFC-6101) &lt;</span><a href=3D"mailto:thomas.=
l.clune@nasa.gov" target=3D"_blank"><span lang=3D"EN-US" style=3D"font-size=
:12pt">thomas.l.clune@nasa.gov</span></a><span lang=3D"EN-US" style=3D"font=
-size:12pt">&gt;<br>
<b>Date:<span class=3D"m_7215615541851461404apple-converted-space">=C2=A0</=
span></b>Tuesday, 19. September 2023 at 16.17<br>
<b>To:<span class=3D"m_7215615541851461404apple-converted-space">=C2=A0</sp=
an></b>General J3 interest list &lt;</span><a href=3D"mailto:j3@mailman.j3-=
fortran.org" target=3D"_blank"><span lang=3D"EN-US" style=3D"font-size:12pt=
">j3@mailman.j3-fortran.org</span></a><span lang=3D"EN-US" style=3D"font-si=
ze:12pt">&gt;<br>
<b>Cc:<span class=3D"m_7215615541851461404apple-converted-space">=C2=A0</sp=
an></b>Jeff Hammond &lt;</span><a href=3D"mailto:jehammond@nvidia.com" targ=
et=3D"_blank"><span lang=3D"EN-US" style=3D"font-size:12pt">jehammond@nvidi=
a.com</span></a><span lang=3D"EN-US" style=3D"font-size:12pt">&gt;, WG5 &lt=
;</span><a href=3D"mailto:sc22wg5@open-std.org" target=3D"_blank"><span lan=
g=3D"EN-US" style=3D"font-size:12pt">sc22wg5@open-std.org</span></a><span l=
ang=3D"EN-US" style=3D"font-size:12pt">&gt;,
 Malcolm Cohen &lt;</span><a href=3D"mailto:malcolm@nag-j.co.jp" target=3D"=
_blank"><span lang=3D"EN-US" style=3D"font-size:12pt">malcolm@nag-j.co.jp</=
span></a><span lang=3D"EN-US" style=3D"font-size:12pt">&gt;<br>
<b>Subject:<span class=3D"m_7215615541851461404apple-converted-space">=C2=
=A0</span></b>Re: [EXTERNAL] [BULK] [J3] [SC22WG5.6486] Subobject of a vari=
able</span><u></u><u></u></p>
</div>
<table border=3D"1" cellpadding=3D"0" style=3D"background-color:rgb(255,235=
,156)">
<tbody>
<tr>
<td style=3D"padding:0.75pt">
<div>
<p class=3D"MsoNormal"><b><span style=3D"font-size:7.5pt;font-family:Verdan=
a,sans-serif;color:black">External email: Use caution opening links or atta=
chments</span></b><u></u><u></u></p>
</div>
</td>
</tr>
</tbody>
</table>
<div>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
<div>
<div>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">I do n=
ot find this situation odd.=C2=A0=C2=A0=C2=A0 Lots of things don=E2=80=99t =
propagate to subobjects.=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0E.g., if an array is=
 allocatable, it=E2=80=99s elements are not.=C2=A0 If an array is pointer, =
it=E2=80=99s elements are not.</span><u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">And =
=E2=80=9Cundefinedness=E2=80=9D is very much a property of subobjects.=C2=
=A0=C2=A0 Indeed, a variable is only defined if all of its subobjects are d=
efined.=C2=A0 (I hope I have that right.)</span><u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
<ul style=3D"margin-top:0cm" type=3D"disc">
<li class=3D"m_7215615541851461404MsoListParagraph" style=3D"margin-top:0cm=
;margin-bottom:0cm">
<span lang=3D"EN-US">Tom</span><span style=3D"font-size:10pt"><u></u><u></u=
></span></li></ul>
<div>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
<div style=3D"border-style:solid none none;border-top-width:1pt;padding:3pt=
 0cm 0cm;border-color:currentcolor">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><b><span lang=3D"EN-US" style=3D"font-size:12pt">Fro=
m:<span class=3D"m_7215615541851461404apple-converted-space">=C2=A0</span><=
/span></b><span lang=3D"EN-US" style=3D"font-size:12pt">J3 &lt;</span><a hr=
ef=3D"mailto:j3-bounces@mailman.j3-fortran.org" target=3D"_blank"><span lan=
g=3D"EN-US" style=3D"font-size:12pt">j3-bounces@mailman.j3-fortran.org</spa=
n></a><span lang=3D"EN-US" style=3D"font-size:12pt">&gt;
 on behalf of j3 &lt;</span><a href=3D"mailto:j3@mailman.j3-fortran.org" ta=
rget=3D"_blank"><span lang=3D"EN-US" style=3D"font-size:12pt">j3@mailman.j3=
-fortran.org</span></a><span lang=3D"EN-US" style=3D"font-size:12pt">&gt;<b=
r>
<b>Reply-To:<span class=3D"m_7215615541851461404apple-converted-space">=C2=
=A0</span></b>j3 &lt;</span><a href=3D"mailto:j3@mailman.j3-fortran.org" ta=
rget=3D"_blank"><span lang=3D"EN-US" style=3D"font-size:12pt">j3@mailman.j3=
-fortran.org</span></a><span lang=3D"EN-US" style=3D"font-size:12pt">&gt;<b=
r>
<b>Date:<span class=3D"m_7215615541851461404apple-converted-space">=C2=A0</=
span></b>Tuesday, September 19, 2023 at 4:57 AM<br>
<b>To:<span class=3D"m_7215615541851461404apple-converted-space">=C2=A0</sp=
an></b>j3 &lt;</span><a href=3D"mailto:j3@mailman.j3-fortran.org" target=3D=
"_blank"><span lang=3D"EN-US" style=3D"font-size:12pt">j3@mailman.j3-fortra=
n.org</span></a><span lang=3D"EN-US" style=3D"font-size:12pt">&gt;<br>
<b>Cc:<span class=3D"m_7215615541851461404apple-converted-space">=C2=A0</sp=
an></b>Jeff Hammond &lt;</span><a href=3D"mailto:jehammond@nvidia.com" targ=
et=3D"_blank"><span lang=3D"EN-US" style=3D"font-size:12pt">jehammond@nvidi=
a.com</span></a><span lang=3D"EN-US" style=3D"font-size:12pt">&gt;, WG5 &lt=
;</span><a href=3D"mailto:sc22wg5@open-std.org" target=3D"_blank"><span lan=
g=3D"EN-US" style=3D"font-size:12pt">sc22wg5@open-std.org</span></a><span l=
ang=3D"EN-US" style=3D"font-size:12pt">&gt;,
 Malcolm Cohen &lt;</span><a href=3D"mailto:malcolm@nag-j.co.jp" target=3D"=
_blank"><span lang=3D"EN-US" style=3D"font-size:12pt">malcolm@nag-j.co.jp</=
span></a><span lang=3D"EN-US" style=3D"font-size:12pt">&gt;<br>
<b>Subject:<span class=3D"m_7215615541851461404apple-converted-space">=C2=
=A0</span></b>[EXTERNAL] [BULK] [J3] [SC22WG5.6486] Subobject of a variable=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<table border=3D"1" cellspacing=3D"0" cellpadding=3D"0" align=3D"left" widt=
h=3D"100%" style=3D"width:100%;border:1.5pt solid black">
<tbody>
<tr>
<td width=3D"100%" style=3D"width:100%;border:none;background-color:rgb(255=
,235,156);padding:3.75pt">
<div>
<p class=3D"MsoNormal">
<b><span style=3D"color:black">CAUTION:</span></b><span class=3D"m_72156155=
41851461404apple-converted-space"><span style=3D"font-size:11pt;color:black=
">=C2=A0</span></span><span style=3D"color:black">This email originated fro=
m outside of NASA.=C2=A0 Please take care when clicking links or opening
 attachments.=C2=A0 Use the &quot;Report Message&quot; button to report sus=
picious messages to the NASA=C2=A0SOC.</span><u></u><u></u></p>
</div>
</td>
</tr>
</tbody>
</table>
<p class=3D"MsoNormal" style=3D"margin-right:0cm;margin-bottom:12pt;margin-=
left:36pt">
<span lang=3D"EN-US" style=3D"font-size:11pt"><br>
<br>
<br>
</span><u></u><u></u></p>
<div>
<div>
<div>
<div>
<div>
<p style=3D"margin-left:36pt"><span lang=3D"EN-US" style=3D"font-size:10.5p=
t;font-family:LMRoman10,serif">If a variable has unspecified locality,</spa=
n><span style=3D"font-size:12pt;font-family:Helvetica"><u></u><u></u></span=
></p>
<p style=3D"margin-left:36pt"><span lang=3D"EN-US" style=3D"font-size:10.5p=
t;font-family:LMRoman10,serif">- if it is referenced in an iteration it sha=
ll either be previously defined during that iteration, or shall not be defi=
ned or become undefined during any
 other iteration; if it is defined or becomes undefined by more than one it=
eration it becomes undefined when the loop terminates;</span><span style=3D=
"font-size:12pt;font-family:Helvetica"><u></u><u></u></span></p>
</div>
</div>
</div>
</div>
<blockquote style=3D"margin:5pt 0cm 5pt 30pt">
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">real, =
dimension(10) :: A</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">do con=
current (integer :: k=3D1:size(A))</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
 A(k) =3D k</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
 if (k.eq.1) A(10) =3D 0</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">end do=
</span><u></u><u></u></p>
</div>
</div>
</blockquote>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">As bes=
t I can tell, A(1:9) are defined after the loop terminates, while A(10) and=
 A are not.=C2=A0 Does the fact that A is undefined before and becomes unde=
fined during this loop imply anything about
 the undefined-ness of its elements during the loop or must one reason abou=
t them strictly independently, based on the element-wise defined/undefined-=
ness?</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">Now su=
ppose I make A shared.=C2=A0 Malcolm said all the elements of A are shared =
as well &quot;It=E2=80=99s not written there now, because, like, how could =
it possibly be anything else?=E2=80=9D</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<blockquote style=3D"margin:5pt 0cm 5pt 30pt">
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">real, =
dimension(10) :: A</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">do con=
current (integer :: k=3D1:size(A)) shared(A)</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
 A(k) =3D k</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
 if (k.eq.1) A(10) =3D 0</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">end do=
</span><u></u><u></u></p>
</div>
</div>
</blockquote>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">It is =
odd to me that the shared-ness of A propagates to its elements but the unde=
fined-ness does not.=C2=A0 Why must I reason about the element-wise behavio=
r of an array independent of the array itself
 when worrying about whether a variable becomes undefined or defined during=
 a loop, but in the same context, they are obviously not independent regard=
ing locality?</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">Jeff</=
span><u></u><u></u></p>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
<div>
<p class=3D"MsoNormal" style=3D"margin-right:0cm;margin-bottom:12pt;margin-=
left:36pt">
<span lang=3D"EN-US" style=3D"font-size:11pt"><br>
<br>
<br>
</span><u></u><u></u></p>
<blockquote style=3D"margin-top:5pt;margin-bottom:5pt">
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">On 19.=
 Sep 2023, at 10.49, Malcolm Cohen via J3 &lt;</span><a href=3D"mailto:j3@m=
ailman.j3-fortran.org" target=3D"_blank"><span lang=3D"EN-US" style=3D"font=
-size:11pt">j3@mailman.j3-fortran.org</span></a><span lang=3D"EN-US" style=
=3D"font-size:11pt">&gt;
 wrote:</span><u></u><u></u></p>
</div>
</div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
<div>
<table border=3D"1" cellpadding=3D"0" style=3D"margin-left:36pt;background-=
color:rgb(255,235,156);word-spacing:0px">
<tbody>
<tr>
<td style=3D"padding:0.75pt">
<div>
<p class=3D"MsoNormal"><b><span style=3D"font-size:7.5pt;font-family:Verdan=
a,sans-serif;color:black">External email: Use caution opening links or atta=
chments</span></b><u></u><u></u></p>
</div>
</td>
</tr>
</tbody>
</table>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">Hi Bra=
d,</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">There =
is no doubt that subobject includes array elements.</span><u></u><u></u></p=
>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">The po=
int is that a subobject of a variable is itself a variable. So nothing more=
 needs to be said on that front.</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">But in=
 the case of a subobject of a constant, that is often not constant. E.g.</s=
pan><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
=C2=A0 INTEGER,PARAMETER :: x(10) =3D [ 1,2,3,4,5,6,7,8,9,10 ]</span><u></u=
><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
=C2=A0 READ *,I</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
 =C2=A0PRINT *,x(I)<span class=3D"m_7215615541851461404apple-converted-spac=
e">=C2=A0</span></span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">Here, =
X(I) is not a variable, and is also not a constant. It is a non-constant su=
bobject of a constant!</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">That i=
s what those words are there for. They are not intended to imply that subob=
jects of a variable are not data objects. They are simply because they are =
also variables, indeed, portions that
 can be defined and redefined separately, and being capable of being define=
d and redefined makes them variables.</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">We cou=
ld add a NOTE to say that =E2=80=9CA subobject of a variable is a variable,=
 but a subobject of a constant is not necessarily itself constant, e.g. if =
it has a non-constant subscript.=E2=80=9D Not sure it
 is really worth it though, at least, not until we decide what to do with o=
ur overly-large set of terms.</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">Cheers=
,</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal" style=3D"text-align:justify"><span lang=3D"EN-US" st=
yle=3D"font-size:10.5pt">--</span><u></u><u></u></p>
</div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal" style=3D"text-align:justify"><span lang=3D"EN-US" st=
yle=3D"font-size:10.5pt">..............Malcolm Cohen, NAG Oxford/Tokyo.</sp=
an><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"border-style:solid none none;border-top-width:1pt;padding:3pt=
 0cm 0cm;border-color:currentcolor">
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><b><span lang=3D"EN-US" style=3D"font-size:11pt">Fro=
m:</span></b><span class=3D"m_7215615541851461404apple-converted-space"><sp=
an lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0</span></span><span lang=
=3D"EN-US" style=3D"font-size:11pt">Brad Richardson &lt;</span><a href=3D"m=
ailto:everythingfunctional@protonmail.com" target=3D"_blank"><span lang=3D"=
EN-US" style=3D"font-size:11pt;color:rgb(5,99,193)">everythingfunctional@pr=
otonmail.com</span></a><span lang=3D"EN-US" style=3D"font-size:11pt">&gt;<s=
pan class=3D"m_7215615541851461404apple-converted-space">=C2=A0</span><br>
<b>Sent:</b><span class=3D"m_7215615541851461404apple-converted-space">=C2=
=A0</span>Thursday, September 14, 2023 10:25 PM<br>
<b>To:</b><span class=3D"m_7215615541851461404apple-converted-space">=C2=A0=
</span>General J3 interest list &lt;</span><a href=3D"mailto:j3@mailman.j3-=
fortran.org" target=3D"_blank"><span lang=3D"EN-US" style=3D"font-size:11pt=
;color:rgb(5,99,193)">j3@mailman.j3-fortran.org</span></a><span lang=3D"EN-=
US" style=3D"font-size:11pt">&gt;;
 &#39;WG5&#39; &lt;</span><a href=3D"mailto:sc22wg5@open-std.org" target=3D=
"_blank"><span lang=3D"EN-US" style=3D"font-size:11pt;color:rgb(5,99,193)">=
sc22wg5@open-std.org</span></a><span lang=3D"EN-US" style=3D"font-size:11pt=
">&gt;<br>
<b>Subject:</b><span class=3D"m_7215615541851461404apple-converted-space">=
=C2=A0</span>[ukfortran] [SC22WG5.6484] [J3] RE: [EXTERNAL] [BULK] are race=
 conditions allowed in do concurrent?</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">Hi Mal=
colm,</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">&gt; &=
gt;variable/data entity/data object</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">&gt; &=
gt;[are]<span class=3D"m_7215615541851461404apple-converted-space">=C2=A0</=
span>circular, and doesn&#39;t seem to include individual array elements</s=
pan><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">&gt; Y=
es it does, see 3.138 subobject.</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">While =
I see that it probably intends to include it, what it actually says is</spa=
n><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">subobj=
ect of a constant</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">so the=
 edit would be to change it to</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">subobj=
ect of a variable or constant</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">I don&=
#39;t think the circularity is causing too much confusion, so I don&#39;t s=
ee much urgency in trying to fix it, and don&#39;t quite see an easy way to=
 do so. I think we can leave it for now.</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">Regard=
s,</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">Brad</=
span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">On Thu=
, 2023-09-14 at 14:04 +0900, Malcolm Cohen via J3 wrote:</span><u></u><u></=
u></p>
</div>
</div>
</div>
<blockquote style=3D"border-style:none none none solid;border-left-width:1.=
5pt;padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt;border-color:currentco=
lor currentcolor currentcolor rgb(114,159,207)">
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">Hi Bra=
d,</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">There =
is no contradiction, subtle or otherwise, here.</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">Locali=
ty-specs are only for named variables. However, as noted, subobjects of var=
iables are also variables.</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">&gt;<s=
pan class=3D"m_7215615541851461404apple-converted-space">=C2=A0</span>The w=
ay I&#39;ve heard &quot;definition&quot; applied to arrays is that definiti=
on of an element of an array does not constitute definition of the variable=
,</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">Correc=
t (except in the trivial case of an array with a single element). This is a=
ll spelled out explicitly: defining every =E2=80=9Cpart=E2=80=9D of a multi=
-part variable defines the variable.</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">I can =
see some potential wording improvements for the next revision, but nothing =
that rises to the level of a defect.</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">E.g. i=
t 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 writ=
ten there now, because, like, how could it possibly be anything
 else? There is nothing else it could be.=C2=A0 But making it explicit woul=
d lead naturally into writing =E2=80=9CIf a variable with SHARED locality i=
s defined=E2=80=A6=E2=80=9D instead of the current =E2=80=9CIf it is define=
d=E2=80=A6=E2=80=9D.</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">&gt;va=
riable/data entity/data object</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">&gt;[a=
re] circular, and doesn&#39;t seem to include individual array elements</sp=
an><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">Yes it=
 does, see 3.138 subobject.</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">The ci=
rcularity is unfortunate, but they are all reasonably worded for comprehens=
ibility (not for trail-following). So it=E2=80=99s either deleting one of t=
hem (ugh) or rewording one to break the circle
 without making it hard to understand (it=E2=80=99s not obvious exactly wha=
t to do here, which is why it is still like this).</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">If it =
were a glossary of terms, instead of a list of definitions, there would be =
no problem with circularity, right?</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">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.</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">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 be=
tter not to call them =E2=80=9Cterms=E2=80=9D!).</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">Cheers=
,</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal" style=3D"text-align:justify"><span lang=3D"EN-US" st=
yle=3D"font-size:10.5pt">--</span><u></u><u></u></p>
</div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal" style=3D"text-align:justify"><span lang=3D"EN-US" st=
yle=3D"font-size:10.5pt">..............Malcolm Cohen, NAG Oxford/Tokyo.</sp=
an><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"border-style:solid none none;border-top-width:1pt;padding:3pt=
 0cm 0cm;border-color:currentcolor">
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><b><span lang=3D"EN-US" style=3D"font-size:11pt">Fro=
m:</span></b><span class=3D"m_7215615541851461404apple-converted-space"><sp=
an lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0</span></span><span lang=
=3D"EN-US" style=3D"font-size:11pt">Brad Richardson &lt;</span><a href=3D"m=
ailto:everythingfunctional@protonmail.com" target=3D"_blank"><span lang=3D"=
EN-US" style=3D"font-size:11pt;color:rgb(5,99,193)">everythingfunctional@pr=
otonmail.com</span></a><span lang=3D"EN-US" style=3D"font-size:11pt">&gt;<s=
pan class=3D"m_7215615541851461404apple-converted-space">=C2=A0</span><br>
<b>Sent:</b><span class=3D"m_7215615541851461404apple-converted-space">=C2=
=A0</span>Wednesday, September 13, 2023 3:49 AM<br>
<b>To:</b><span class=3D"m_7215615541851461404apple-converted-space">=C2=A0=
</span>General J3 interest list &lt;</span><a href=3D"mailto:j3@mailman.j3-=
fortran.org" target=3D"_blank"><span lang=3D"EN-US" style=3D"font-size:11pt=
;color:rgb(5,99,193)">j3@mailman.j3-fortran.org</span></a><span lang=3D"EN-=
US" style=3D"font-size:11pt">&gt;;
 WG5 &lt;</span><a href=3D"mailto:sc22wg5@open-std.org" target=3D"_blank"><=
span lang=3D"EN-US" style=3D"font-size:11pt;color:rgb(5,99,193)">sc22wg5@op=
en-std.org</span></a><span lang=3D"EN-US" style=3D"font-size:11pt">&gt;<br>
<b>Subject:</b><span class=3D"m_7215615541851461404apple-converted-space">=
=C2=A0</span>[ukfortran] [SC22WG5.6480] [EXTERNAL] [BULK] [J3] are race con=
ditions allowed in do concurrent?</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">Hmm...=
 I decided to work through this a bit more thoroughly.</span><u></u><u></u>=
</p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">From t=
he syntax definitions:</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">R902</=
span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">variab=
le</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">is des=
ignator</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">or fun=
ction-reference</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">R901</=
span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">design=
ator</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">is obj=
ect-name</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">or arr=
ay-element</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">or arr=
ay-section</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">or coi=
ndexed-named-object</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">or com=
plex-part-designator</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">or str=
ucture-component</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">or sub=
string</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">Ok, so=
 according to the syntax an array element is a variable.</span><u></u><u></=
u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">From t=
he terms and definitions:</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">variab=
le</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">data e=
ntity (3.41) that can be defined (3.48) and redefined during execution of a=
 program</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">data e=
ntity</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">data o=
bject (3.42), result of the evaluation of an expression, or the result of t=
he execution of a function reference</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">data o=
bject</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">consta=
nt, variable, or subobject of a constant</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">which =
is circular, and doesn&#39;t seem to include individual array elements.</sp=
an><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">So now=
 the question is which &quot;definition&quot; does the DO CONCURRENT constr=
aint refer to?</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">From t=
he syntax definitions:</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">R1129<=
/span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">concur=
rent-locality</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">is</sp=
an><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">[ loca=
lity-spec ]...</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">R1130<=
/span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">locali=
ty-spec</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">is LOC=
AL ( variable-name-list )</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">or LOC=
AL_INIT ( variable-name-list )</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">or RED=
UCE ( reduce-operation : variable-name-list )</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">or SHA=
RED ( variable-name-list )</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">or DEF=
AULT ( NONE )</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">only a=
llows variable-name, not designator, so it&#39;s not exactly clear.</span><=
u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">The &q=
uot;constraint&quot; appears in normative text, I.e.</span><u></u><u></u></=
p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">If a v=
ariable has</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">which =
is not hyperlinked and is not in a font indicating reference to the syntax =
term.</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">My rea=
ding 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&#39;s valid to (un)define *different* elem=
ents of an array in separate iterations, but not valid to (un)define and re=
ference the same element of an array in separate iterations.</span><u></u><=
u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">I thin=
k it would be worth &quot;fixing&quot; the terms and definitions to elimina=
te the circular definition and make it consistent with the syntax.</span><u=
></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">Regard=
s,</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">Brad</=
span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">On Tue=
, 2023-09-12 at 17:37 +0000, Clune, Thomas L. (GSFC-6101) wrote:</span><u><=
/u><u></u></p>
</div>
</div>
</div>
<blockquote style=3D"border-style:none none none solid;border-left-width:1.=
5pt;padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt;border-color:currentco=
lor currentcolor currentcolor rgb(114,159,207)">
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=E2=80=
=9CVariable=E2=80=9D does not mean what we think it means:=C2=A0=C2=A0=C2=
=A0=C2=A0 &lt;variable&gt;=C2=A0 =C2=A0&lt;&lt;is&gt;&gt;=C2=A0 &lt;designa=
tor&gt; &lt;&lt;or&gt;&gt; &lt;function-reference&gt;</span><u></u><u></u><=
/p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">And &l=
t;designator&gt; includes &lt;array-element&gt;.</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">But I =
for one would not mind an explanatory note that clarifies the common use ca=
se of array elements in this context.=C2=A0</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div style=3D"border-style:solid none none;border-top-width:1pt;padding:3pt=
 0cm 0cm;border-color:currentcolor">
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><b><span lang=3D"EN-US" style=3D"font-size:12pt">Fro=
m:</span></b><span lang=3D"EN-US" style=3D"font-size:12pt">J3 &lt;</span><a=
 href=3D"mailto:j3-bounces@mailman.j3-fortran.org" target=3D"_blank"><span =
lang=3D"EN-US" style=3D"font-size:12pt;color:rgb(5,99,193)">j3-bounces@mail=
man.j3-fortran.org</span></a><span lang=3D"EN-US" style=3D"font-size:12pt">=
&gt;
 on behalf of j3 &lt;</span><a href=3D"mailto:j3@mailman.j3-fortran.org" ta=
rget=3D"_blank"><span lang=3D"EN-US" style=3D"font-size:12pt;color:rgb(5,99=
,193)">j3@mailman.j3-fortran.org</span></a><span lang=3D"EN-US" style=3D"fo=
nt-size:12pt">&gt;<br>
<b>Reply-To:<span class=3D"m_7215615541851461404apple-converted-space">=C2=
=A0</span></b>j3 &lt;</span><a href=3D"mailto:j3@mailman.j3-fortran.org" ta=
rget=3D"_blank"><span lang=3D"EN-US" style=3D"font-size:12pt;color:rgb(5,99=
,193)">j3@mailman.j3-fortran.org</span></a><span lang=3D"EN-US" style=3D"fo=
nt-size:12pt">&gt;<br>
<b>Date:<span class=3D"m_7215615541851461404apple-converted-space">=C2=A0</=
span></b>Tuesday, September 12, 2023 at 12:19 PM<br>
<b>To:<span class=3D"m_7215615541851461404apple-converted-space">=C2=A0</sp=
an></b>j3 &lt;</span><a href=3D"mailto:j3@mailman.j3-fortran.org" target=3D=
"_blank"><span lang=3D"EN-US" style=3D"font-size:12pt;color:rgb(5,99,193)">=
j3@mailman.j3-fortran.org</span></a><span lang=3D"EN-US" style=3D"font-size=
:12pt">&gt;, WG5 &lt;</span><a href=3D"mailto:sc22wg5@open-std.org" target=
=3D"_blank"><span lang=3D"EN-US" style=3D"font-size:12pt;color:rgb(5,99,193=
)">sc22wg5@open-std.org</span></a><span lang=3D"EN-US" style=3D"font-size:1=
2pt">&gt;<br>
<b>Cc:<span class=3D"m_7215615541851461404apple-converted-space">=C2=A0</sp=
an></b>Brad Richardson &lt;</span><a href=3D"mailto:everythingfunctional@pr=
otonmail.com" target=3D"_blank"><span lang=3D"EN-US" style=3D"font-size:12p=
t;color:rgb(5,99,193)">everythingfunctional@protonmail.com</span></a><span =
lang=3D"EN-US" style=3D"font-size:12pt">&gt;<br>
<b>Subject:<span class=3D"m_7215615541851461404apple-converted-space">=C2=
=A0</span></b>[EXTERNAL] [BULK] [J3] [SC22WG5.6477] are race conditions all=
owed in do concurrent?</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<table border=3D"1" cellspacing=3D"0" cellpadding=3D"0" align=3D"left" widt=
h=3D"100%" style=3D"width:100%;border:1.5pt solid black">
<tbody>
<tr>
<td width=3D"100%" style=3D"width:100%;border:none;background-color:rgb(255=
,235,156);padding:3.75pt">
<div>
<div>
<p class=3D"MsoNormal">
<b><span style=3D"color:black">CAUTION:</span></b><span class=3D"m_72156155=
41851461404apple-converted-space"><span style=3D"font-size:11pt;color:black=
">=C2=A0</span></span><span style=3D"color:black">This email originated fro=
m outside of NASA.=C2=A0 Please take care when clicking links or opening
 attachments.=C2=A0 Use the &quot;Report Message&quot; button to report sus=
picious messages to the NASA=C2=A0SOC.</span><u></u><u></u></p>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<p class=3D"MsoNormal" style=3D"margin-right:0cm;margin-bottom:12pt;margin-=
left:72pt">
<span lang=3D"EN-US" style=3D"font-size:11pt"><br>
<br>
<br>
<br>
<br>
<br>
</span><u></u><u></u></p>
<div>
<div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">Hi Jef=
f,</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">Based =
on &quot; If it is defined or becomes undefined during any iteration, it sh=
all not be referenced, defined, or become undefined during any other iterat=
ion.&quot;, the provide program is invalid, because
 `x` becomes defined in more than one iteration.</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">The wa=
y I&#39;ve heard &quot;definition&quot; applied to arrays is that definitio=
n 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><u=
></u><u></u></p>
</div>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">My opi=
nion is that the above constraint simply does not adequately describe/is st=
ill ambiguous about the case of arrays. I think an interp would be warrante=
d, and we should say that an element
 of an array should have the same constraint as above if the variable is sh=
ared.</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">Regard=
s,</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">Brad</=
span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11pt">On Tue=
, 2023-09-12 at 14:43 +0000, Jeff Hammond via J3 wrote:</span><u></u><u></u=
></p>
</div>
</div>
</div>
<blockquote style=3D"border-style:none none none solid;border-left-width:1.=
5pt;padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt;border-color:currentco=
lor currentcolor currentcolor rgb(114,159,207)">
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">Is thi=
s a legal program in Fortran with defined behavior?=C2=A0 If it is illegal =
or the behavior is undefined, where do we say that?</span><u></u><u></u></p=
>
</div>
</div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">progra=
m main</span><u></u><u></u></p>
</div>
</div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">=C2=A0=
 integer :: k</span><u></u><u></u></p>
</div>
</div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">=C2=A0=
 real :: x</span><u></u><u></u></p>
</div>
</div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">=C2=A0=
 x =3D 0.0</span><u></u><u></u></p>
</div>
</div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">=C2=A0=
 do concurrent (k=3D1:2) shared(x)</span><u></u><u></u></p>
</div>
</div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">=C2=A0=
=C2=A0=C2=A0 x =3D real(k)</span><u></u><u></u></p>
</div>
</div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">=C2=A0=
 end do</span><u></u><u></u></p>
</div>
</div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">=C2=A0=
 print*,x</span><u></u><u></u></p>
</div>
</div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">end pr=
ogram main</span><u></u><u></u></p>
</div>
</div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">Is tha=
t what the following is intended to do?</span><u></u><u></u></p>
</div>
</div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">=E2=80=
=9CIf a variable has SHARED locality, appearances of the variable within th=
e 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><u></u><u></u></p>
</div>
</div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">If so,=
 then I am struggling to apply this to arrays.=C2=A0 When we say a variable=
 has shared locality, is the variable the array or the element?=C2=A0 We ca=
n only put array names in SHARED(), but applying
 the text regarding =E2=80=9Cto become defined=E2=80=9D from the perspectiv=
e of arrays appears to have interesting consequences.</span><u></u><u></u><=
/p>
</div>
</div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">=C2=A0=
</span><u></u><u></u></p>
</div>
</div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt">Thanks=
,</span><u></u><u></u></p>
</div>
</div>
<div style=3D"margin-left:36pt">
<div style=3D"margin-left:36pt">
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12pt"><br>
Jeff</span><u></u><u></u></p>
</div>
</div>
</blockquote>
</div>
</blockquote>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<p class=3D"MsoNormal"><span style=3D"font-size:11pt"><u></u>=C2=A0<u></u><=
/span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

</div></blockquote></div></div>

--000000000000df00290605c99827--
