From owner-sc22wg5+sc22wg5-dom9=www.open-std.org@open-std.org  Tue Sep 12 16:43:45 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 8FD1A356977; Tue, 12 Sep 2023 16:43:45 +0200 (CEST)
Delivered-To: sc22wg5@open-std.org
Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2040.outbound.protection.outlook.com [40.107.92.40])
	by www.open-std.org (Postfix) with ESMTP id 1AFB1356973
	for <sc22wg5@open-std.org>; Tue, 12 Sep 2023 16:43:42 +0200 (CEST)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=l43mfe+9+FWX61FyLQmYelZULrXL5UjBn5REp/5v7ggpo/OkBv2GnkXIvDCu+zGAvPcxJSQ8lje1FrhZPrPv9nAIPB0OfJ5//riKVpjs2zUO+32GobnaiS2eaATXbD+11/S+Ys90g1gD1ObPPClIOIN+HfL9dQeeuGOQ6FHpwT+4Qu4jL/LDvw90cS4cmxh/xxPhTjLmIVYaz7G+r2HWhrvH+tNDaa4wplUtAeujz+9RD757iw/yz3DDlMTmGiSiB2I6yhCm1OrD9BiNt+BmUdZ40bhFEvKmXKnIkzRlFJ3z9ptfLMkG6VhY2sfUg5tpNBhluye4VSTou4Sy0KiWSA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=YagPCRrR+62CDkKo7b7Ia9Q0H1Ev5jZ2h7mrQQ9w2dE=;
 b=heQ5cG5l55NTK+ElBVVHvC0vlxx707gnQi2FqWc1/02hGGwevnlamS6qxS/Q7FZ5fdqS4XFULYPOeGhMofOBTOwpxxzElPTafm2Gl5eRIx17NQ0uJAmG0qaxzltY56p09bURB9dCjYxy0jnws3AkKWAhn0NGPu7E8VwiINAaiczNHvfCRUb7ZrQyAxEly9pL7uKUbVYovd+Sf3/DJMl02t+xC1W6/nhUNRs55Ba9CJa2fWQnMUhtnDYXYYWV5NI8OhTSaMNPr681eG3Ar49Ib26MmEqm/qF6CkQ8zzZa/fSic2/0W4QDrYIS68YwBIyuFCJnEqe3Eu1o+1IAs96l0Q==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com;
 dkim=pass header.d=nvidia.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;
 s=selector2;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=YagPCRrR+62CDkKo7b7Ia9Q0H1Ev5jZ2h7mrQQ9w2dE=;
 b=h/clclzqpu/LX7LqkOWpcAgnIjEzv/x3A+/7WV2Dz9GmEpf/yaPPZQ6cqsx3kzQef5m7mLuS6FMyJte39ictDvCy5W1A33l5yhkGeehz29zipGplkXNBAAKq6wha0kJPNWchugn62hauw0HMYaGxrV2GnCOJ2CaLoykWj1zXKuSSBeMtavsRtrnunlpoHNXNar1lIS8wXHq1Ox33C7SRxI4NLz652/mFcNOcYZpBjnBBtGQnD6xl1vyvWO5kvn0Ww/OpbGQeMb8DG3l6bvn4SIU8X+d6rAz7HvtBKUmzyQjmO0KojadeoI6ysBfKy5i+3Yiko/7UXVVNdtOixr+KXA==
Received: from DM6PR12MB3130.namprd12.prod.outlook.com (2603:10b6:5:11b::16)
 by PH0PR12MB7888.namprd12.prod.outlook.com (2603:10b6:510:28b::20) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30; Tue, 12 Sep
 2023 14:43:39 +0000
Received: from DM6PR12MB3130.namprd12.prod.outlook.com
 ([fe80::59af:3a04:c24f:8191]) by DM6PR12MB3130.namprd12.prod.outlook.com
 ([fe80::59af:3a04:c24f:8191%5]) with mapi id 15.20.6768.036; Tue, 12 Sep 2023
 14:43:39 +0000
From: Jeff Hammond <jehammond@nvidia.com>
To: WG5 <sc22wg5@open-std.org>
Subject: are race conditions allowed in do concurrent?
Thread-Topic: are race conditions allowed in do concurrent?
Thread-Index: AQHZ5YYP6gbRHwoXvUG3m9LA/LCOMQ==
Date: Tue, 12 Sep 2023 14:43:38 +0000
Message-ID:
 <DM6PR12MB31302BD1D034319D5CD42B7ACBF1A@DM6PR12MB3130.namprd12.prod.outlook.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=nvidia.com;
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: DM6PR12MB3130:EE_|PH0PR12MB7888:EE_
x-ms-office365-filtering-correlation-id: 5e4ce280-76a7-47db-c2ae-08dbb39ea6c9
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info:
 R8eWtmrtC92hPDBI4bVBBQbXUqehlAeDlC3DBrkwRWsHGLEjwKZSMGjO87Bgs17W56cUFTpBq3XEuCizQh39sY6ombbuOSeKeTH26eUtEqFpCBLkvwEyfyP5mOwI84ywOSzGPfinIrd68lDnUaE2jW1rZl+5xrZYnd4+kFrpjoYEfEKVMmPdmkqSLng3K2IFpdkDJ0Gv9YfcRRYlv2807pKEGsbfr5SCFS519shV97O7T3j/GpggLp1IzQh6V+yuIgAkF5aMhHDaFm29L7AYDMhmnlkR94ac/otPY/OLMTm7PWWARFtV6+9DadE8swLo+Fl3n9J30HPMA94cL7xw+/iSUHbUADNOEqrjbQXqSyqk8z//vuTtpAqcMQBR9389HEKQegsxRW4NjAKJnkzO2YueQWVKHT7peeTINAFJ2Sy+jeLW9SR4/GmZi8bWKVX9PVcXaHch4RXzYPCh/Bh0Dy73PWYmTw90qvj04yF7zNRUujqm7AY4xPbSrb0x0hvuq3kXsQR6Px5avqmmPPCkx4/dyjXdi3CPqN6CBgmKyKemvpUkbIwENYWMyAoe0eiGmU4jvOqqXLQQAyE41wVh/8wHArKE3PKgZ/51WxwJKz5Nk8paWwzLuj5XGoVET0Ns
x-forefront-antispam-report:
 CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB3130.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(136003)(376002)(346002)(396003)(39860400002)(186009)(451199024)(1800799009)(6506007)(9686003)(71200400001)(7696005)(66946007)(478600001)(4744005)(41300700001)(66446008)(6916009)(66556008)(2906002)(52536014)(66476007)(64756008)(76116006)(8676002)(316002)(26005)(5660300002)(8936002)(55016003)(86362001)(38070700005)(38100700002)(33656002)(122000001);DIR:OUT;SFP:1101;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0:
 =?Windows-1252?Q?7iApOZaKwWF5pPUbK1pCTK1u6eogE9U2tcExZemedoQB0G1aDfilnjmR?=
 =?Windows-1252?Q?hLIltXGFpW4/kI9kWY11j3KUPWMFHj4RlNneTgnau5W5Y0ldAOq4GDbm?=
 =?Windows-1252?Q?d+tazQNxzezSbBaCr1riR3sxuby+eKwu8tBbvAy6qxNgqqiDu6/mohia?=
 =?Windows-1252?Q?eO2a3UfttdPpMlWYnU1hD97huOGysspI4QuZXteIp03aCBLSAse/K4aN?=
 =?Windows-1252?Q?eYmToAfVL3/TnMiknLshp8XUYXg/0g1MF4KA2+Y3jtUQymgsWpWpuvTm?=
 =?Windows-1252?Q?Ty49syWzvTuwE1SNs/1WES40SuZhtGMo0bLo8ma3DQSDURA3QzNSQ8qK?=
 =?Windows-1252?Q?iaGCiBR6w+eE027LfqTR4ywHszJELJs4hbheRGc3T6Cdqo3hyVrWSaYz?=
 =?Windows-1252?Q?zYe8k22F/OPzk5JCxqr3MSCcQ2djXDn3a+e+q719tqq04lTnlwG3uPZ7?=
 =?Windows-1252?Q?J+WdbgSSJAFj/VulYdZ6rrr4iOfuNU8FO/L0APQKfGcMJsjkMmerPruJ?=
 =?Windows-1252?Q?XLlFtE+7AmJzzgl0iZjkRMxc2NfT2zk5rHQ0XUSm8ysHQDA38+AhBgZo?=
 =?Windows-1252?Q?SKlL6l0lWxq4C+VtAEGNBWBhTWYZl1vJ//OqF56BTO5YtZ2IHzWvcLla?=
 =?Windows-1252?Q?Ue+gZs1zCwYvqcVApqR4Vi0JxAwOEZsr9VXbWJG8cmDP2ZEDRG28p2XC?=
 =?Windows-1252?Q?91r8HfOcdK+GEZexDPgyRlOlY3JZKhSzYC0NZrgR+dJCOqNpCmMZyEl/?=
 =?Windows-1252?Q?KxB56wcFnHywF3yGf247aZN3GvXQJpdy8bwY9Vy8DDo2pDx8eqBW28V2?=
 =?Windows-1252?Q?4H9mDaVz9we5b0Hpu0T9uEKvZ6hidDLaKM2/km593jK8FWlggusc0w3Q?=
 =?Windows-1252?Q?48y+fF3qPhevv3xY2i7jtEvusp6O03u8LAHTvkaktK1F5zp52/Yf3FKm?=
 =?Windows-1252?Q?XWiyBZu++/tknJOJz7+yZ9LXdvPGv4JWW95u+JBLS0rrABgqrcuojwB/?=
 =?Windows-1252?Q?jTJxPlz0TazCxdnhAQYa6mcRRjSrEWCbgkH0Fz9HM/fQFnmgQdGLU0jE?=
 =?Windows-1252?Q?VHxWPoHmOYRfueBSU6N/Y1srel7UBdeNanHUhwZ/npWynMISia0trGZs?=
 =?Windows-1252?Q?WYR4NdLZutJ83y5B9Y7Nk6rZJ9kM3ThdoggeOcvmNjMn7Z4SUDmBiMJ5?=
 =?Windows-1252?Q?yhEMkjdTCkX/eN84BYX1U1fXc0BSEZJpufru/bzG+dZUkiM74FjfM72v?=
 =?Windows-1252?Q?hLJxtzVXHRrLrGM+pGarx9LY91N+v84xMA1UrzYUSyV0mRO6+3K6tdXL?=
 =?Windows-1252?Q?3G63zVKPkD2ghvg9xFtQQxBeDjaVrjft0S00E596y1F2JQb7ur1eaagN?=
 =?Windows-1252?Q?jW1wptiiiWBC2US//lQxPtrqP3rdFB6yHo6nKfVJObfGLYNqRERBqdHZ?=
 =?Windows-1252?Q?op0YI33kkXUwxMsKkwfHu++c2EMf8RutkueMZGgc5Pd8eW9k5+lEumfB?=
 =?Windows-1252?Q?/cEDmqNUaHyGmFtN1dJ7dvKPaECieJXvT6m8szZonoMem0A+rGauzKEo?=
 =?Windows-1252?Q?PpNVWJZXfu5hM0wM/8sZwycs8TIyEFwJtX2W9xgnxzvh/94aXCumJFQH?=
 =?Windows-1252?Q?l60W42qki3S9qOmmNK+iiEASM6UgWAlYP4MG/4Ofn76B3i7BWnlYhZxa?=
 =?Windows-1252?Q?zKWWi79ApWvx8w7meY7uWGJHnxjQRZ4YORvAwPVmMWMnCuhRM2Cr3A?=
 =?Windows-1252?Q?=3D=3D?=
Content-Type: multipart/alternative;
	boundary="_000_DM6PR12MB31302BD1D034319D5CD42B7ACBF1ADM6PR12MB3130namp_"
MIME-Version: 1.0
X-OriginatorOrg: Nvidia.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3130.namprd12.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 5e4ce280-76a7-47db-c2ae-08dbb39ea6c9
X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Sep 2023 14:43:38.7416
 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: 1f98dj6GR45E48noXHXdVSOMlM6dnnmPCepIBQUOKQY78VBmmrcZkHlATG3Cvno2r2WFsXCfDkd2eLbGrjpWcA==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7888
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

--_000_DM6PR12MB31302BD1D034319D5CD42B7ACBF1ADM6PR12MB3130namp_
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

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?

=93If 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 refe=
renced, defined, or become undefined during any other iteration.=94

If so, then I am struggling to apply this to arrays.  When we say a variabl=
e has shared locality, is the variable the array or the element?  We can on=
ly put array names in SHARED(), but applying the text regarding =93to becom=
e defined=94 from the perspective of arrays appears to have interesting con=
sequences.

Thanks,

Jeff


--_000_DM6PR12MB31302BD1D034319D5CD42B7ACBF1ADM6PR12MB3130namp_
Content-Type: text/html; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" xmlns:w=3D"urn:sc=
hemas-microsoft-com:office:word" xmlns:m=3D"http://schemas.microsoft.com/of=
fice/2004/12/omml" xmlns=3D"http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1=
252">
<meta name=3D"Generator" content=3D"Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:"Times New Roman \(Body CS\)";
	panose-1:2 11 6 4 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;
	mso-ligatures:standardcontextual;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri",sans-serif;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
	{page:WordSection1;}
--></style>
</head>
<body lang=3D"en-FI" link=3D"#0563C1" vlink=3D"#954F72" style=3D"word-wrap:=
break-word">
<div class=3D"WordSection1">
<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt">Is this a legal pro=
gram in Fortran with defined behavior?&nbsp; If it is illegal or the behavi=
or is undefined, where do we say that?</span><span lang=3D"EN-US" style=3D"=
font-size:12.0pt"><o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt"><o:p>&nbsp;</o:p></=
span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt">program main<o:p></=
o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt">&nbsp; integer :: k=
<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt">&nbsp; real :: x<o:=
p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt">&nbsp; x =3D 0.0</s=
pan><span lang=3D"EN-US" style=3D"font-size:12.0pt"><o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt">&nbsp; do concurren=
t (k=3D1:2) shared(x)<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt">&nbsp;&nbsp;&nbsp; =
x =3D real(k)<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt">&nbsp; end do<o:p><=
/o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt">&nbsp; print*,x</sp=
an><span lang=3D"EN-US" style=3D"font-size:12.0pt"><o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt">end program main<o:=
p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt"><o:p>&nbsp;</o:p></=
span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12.0pt">Is t=
hat what the following is intended to do?<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12.0pt"><o:p=
>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt">=93If a variable ha=
s SHARED locality, appearances of the variable within the DO CONCURRENT con=
struct refer to the variable in the innermost executable construct or scopi=
ng 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 iter=
ation.</span><span lang=3D"EN-US" style=3D"font-size:12.0pt">=94<o:p></o:p>=
</span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12.0pt"><o:p=
>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12.0pt">If s=
o, then I am struggling to apply this to arrays.&nbsp; When we say a variab=
le has shared locality, is the variable the array or the element?&nbsp; We =
can only put array names in SHARED(), but applying
 the text regarding =93to become defined=94 from the perspective of arrays =
appears to have interesting consequences.<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12.0pt"><o:p=
>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt">Thanks,<o:p></o:p><=
/span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt"><br>
Jeff</span><span lang=3D"EN-US" style=3D"font-size:12.0pt"><o:p></o:p></spa=
n></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:12.0pt"><o:p=
>&nbsp;</o:p></span></p>
</div>
</body>
</html>

--_000_DM6PR12MB31302BD1D034319D5CD42B7ACBF1ADM6PR12MB3130namp_--
