From owner-sc22wg5+sc22wg5-dom8=www.open-std.org@open-std.org  Thu Dec  4 18:02:47 2014
Return-Path: <owner-sc22wg5+sc22wg5-dom8=www.open-std.org@open-std.org>
X-Original-To: sc22wg5-dom8
Delivered-To: sc22wg5-dom8@www.open-std.org
Received: by www.open-std.org (Postfix, from userid 521)
	id 395CD3584F8; Thu,  4 Dec 2014 18:02:47 +0100 (CET)
Delivered-To: sc22wg5@open-std.org
X-Greylist: delayed 423 seconds by postgrey-1.34 at www5.open-std.org; Thu, 04 Dec 2014 18:02:46 CET
Received: from postout1.mail.lrz.de (postout1.mail.lrz.de [129.187.255.137])
	by www.open-std.org (Postfix) with ESMTP id B786F356DE6
	for <sc22wg5@open-std.org>; Thu,  4 Dec 2014 18:02:43 +0100 (CET)
Received: from lxmhs51.srv.lrz.de (localhost [127.0.0.1])
	by postout1.mail.lrz.de (Postfix) with ESMTP id 3jtjpy2z3vzyS9
	for <sc22wg5@open-std.org>; Thu,  4 Dec 2014 17:55:38 +0100 (CET)
Authentication-Results: postout.lrz.de (amavisd-new); dkim=pass (2048-bit key)
	reason="pass (just generated, assumed good)" header.d=lrz.de
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lrz.de; h=
	mime-version:content-type:content-type:content-language
	:accept-language:message-id:date:date:subject:subject:from:from
	:received:received:received:received; s=postout; t=1417712138;
	 bh=buoOuYwE+pQob/uJrzniJAVra7yuziiibxSePJ7JUuc=; b=koEayA/17alm
	z3qht0gmPMlGUhgVU8TpEql/kdBngQbokMdVr6VrnKQf7/TGXKW4SGSkbHVpKyuY
	KKCPFlgGbhCgN/MeHKBMRlz4kMZuiMlptGi3wjIydddk8M6d1q3DxwFWodezgW8l
	65VGL9UsbBO1kNKun8L39piiEsmFPV8G7qwjzH6X9RjCYjr0BxGVoPkWqBl8N5tD
	WEdqY4nC4Prutx65WbcaoevndX3zKVDndAupnPdjnwi1kOcz3z3xQUHMnLj7KU5z
	/UjV1thxto/uLIHHj+5by6v8vTnEhh63Md50oK8kbQdBYvtuHqa+F5542G7PTaWt
	TXJS0AS4Pw==
X-Virus-Scanned: by amavisd-new at lrz.de in lxmhs51.srv.lrz.de
X-Spam-Flag: NO
X-Spam-Score: -1.887
X-Spam-Level:
X-Spam-Status: No, score=-1.887 tagged_above=-999 required=5
	tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, LRZ_DATE_TZ_0000=0.001,
	LRZ_DKIM_DESTROY_MTA=0.001, LRZ_DMARC_OVERWRITE=0.001,
	LRZ_FROM_AP_PHRASE=0.001, LRZ_FROM_PHRASE=0.001,
	LRZ_FROM_PRE_SUR_ADDR=0.001, LRZ_FWD_MS_EX=0.001,
	LRZ_HAS_X_ORIG_IP=0.001, LRZ_MSGID_HL32=0.001,
	LRZ_MSGID_SPAM_68=0.001, LRZ_RCVD_MS_EX=0.001, SPF_HELO_NONE=0.001]
	autolearn=no
Received: from postout1.mail.lrz.de ([127.0.0.1])
	by lxmhs51.srv.lrz.de (lxmhs51.srv.lrz.de [127.0.0.1]) (amavisd-new, port 20024)
	with LMTP id rhCWFrey3hqr for <sc22wg5@open-std.org>;
	Thu,  4 Dec 2014 17:55:38 +0100 (CET)
Received: from BADWLRZ-SW13MB2.ads.mwn.de (BADWLRZ-SW13MB2.ads.mwn.de [IPv6:2001:4ca0:0:108::156])
	(using TLSv1 with cipher RC4-SHA (128/128 bits))
	(Client CN "BADWLRZ-SW13MB2", Issuer "BADWLRZ-SW13MB2" (not verified))
	by postout1.mail.lrz.de (Postfix) with ESMTPS id 3jtjpy0RJ0zyRp
	for <sc22wg5@open-std.org>; Thu,  4 Dec 2014 17:55:38 +0100 (CET)
Received: from BADWLRZ-SW13MB1.ads.mwn.de (2001:4ca0:0:108::155) by
 BADWLRZ-SW13MB2.ads.mwn.de (2001:4ca0:0:108::156) with Microsoft SMTP Server
 (TLS) id 15.0.995.29; Thu, 4 Dec 2014 17:55:37 +0100
Received: from BADWLRZ-SW13MB1.ads.mwn.de ([fe80::89:5514:4b27:d8be]) by
 BADWLRZ-SW13MB1.ads.mwn.de ([fe80::89:5514:4b27:d8be%12]) with mapi id
 15.00.0995.028; Thu, 4 Dec 2014 17:55:37 +0100
From: "Bader, Reinhold" <Reinhold.Bader@lrz.de>
To: WG5 <sc22wg5@open-std.org>
Subject: Question on PURE subroutines
Thread-Topic: Question on PURE subroutines
Thread-Index: AdAP4M/rJll26hGBT5a6eQ7bW9hqCA==
Date: Thu, 4 Dec 2014 16:55:36 +0000
Message-ID: <b14b65f86e6c40acafdc56e94998d4bd@BADWLRZ-SW13MB1.ads.mwn.de>
Accept-Language: de-DE, en-US
Content-Language: de-DE
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [2001:4ca0:0:f000:9f5:55b9:1f20:f0d2]
Content-Type: multipart/alternative;
	boundary="_000_b14b65f86e6c40acafdc56e94998d4bdBADWLRZSW13MB1adsmwnde_"
MIME-Version: 1.0
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

--_000_b14b65f86e6c40acafdc56e94998d4bdBADWLRZSW13MB1adsmwnde_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hello all,

consider the program

module mod_proc_cont_01
  implicit none
  type :: cont
     real, pointer :: p(:) =3D> null()
  end type cont
  real, target :: p(2)
contains
  pure subroutine pf(x)
    type(cont), intent(inout) :: x
    integer :: i

    if (associated(x%p)) then
       x%p =3D [ (real(2*i), i=3D1, size(x%p)) ]
    end if
  end subroutine pf
end module mod_proc_cont_01
program proc_cont_01
  use mod_proc_cont_01
  implicit none
  type(cont) :: xx

  p =3D [ 1.0, 2.0 ]
  xx%p =3D> p
  call pf(xx)
  write(*,*) p
end program proc_cont_01


It appears to conform to the Fortran 2008 standard; it is accepted by the c=
ompilers available to me. Yet it
appears to implement a side effect in a PURE procedure. Was this intended? =
If not, would adding the following
text in 007 fix the problem?

[312:30] After "any designator", add " with the POINTER attribute or "

Cheers
Reinhold


--_000_b14b65f86e6c40acafdc56e94998d4bdBADWLRZSW13MB1adsmwnde_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
<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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;
	mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#0563C1;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:#954F72;
	text-decoration:underline;}
span.E-MailFormatvorlage17
	{mso-style-type:personal-compose;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri",sans-serif;
	mso-fareast-language:EN-US;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"DE" link=3D"#0563C1" vlink=3D"#954F72">
<div class=3D"WordSection1">
<p class=3D"MsoNormal">Hello all, <o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">consider the program<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">module mod_proc_cont_01<o:p></o=
:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">&nbsp; implicit none<o:p></o:p>=
</span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">&nbsp; type :: cont<o:p></o:p><=
/span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">&nbsp;&nbsp;&nbsp;&nbsp; real, =
pointer :: p(:) =3D&gt; null()<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">&nbsp; end type cont<o:p></o:p>=
</span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">&nbsp; real, target :: p(2)<o:p=
></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">contains<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">&nbsp; pure subroutine pf(x) <o=
:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">&nbsp;&nbsp;&nbsp;&nbsp;type(co=
nt), intent(inout) :: x<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">&nbsp;&nbsp;&nbsp; integer :: i=
<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">&nbsp;&nbsp;&nbsp; if (associat=
ed(x%p)) then<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp; x%p =3D [ (real(2*i), i=3D1, size(x%p)) ]<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">&nbsp;&nbsp;&nbsp; end if<o:p><=
/o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">&nbsp; end subroutine pf<o:p></=
o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">end module mod_proc_cont_01<o:p=
></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">program proc_cont_01<o:p></o:p>=
</span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">&nbsp; use mod_proc_cont_01<o:p=
></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">&nbsp; implicit none<o:p></o:p>=
</span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">&nbsp; type(cont) :: xx<o:p></o=
:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">&nbsp; p =3D [ 1.0, 2.0 ]<o:p><=
/o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">&nbsp; xx%p =3D&gt; p<o:p></o:p=
></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">&nbsp;&nbsp;call pf(xx)<o:p></o=
:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">&nbsp; </span>write(*,*) p<o:p>=
</o:p></p>
<p class=3D"MsoNormal">end program proc_cont_01<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">It appears to conform to the Fo=
rtran 2008 standard; it is accepted by the compilers available to me. Yet i=
t
<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">appears to implement a side eff=
ect in a PURE procedure. Was this intended? If not, would adding the follow=
ing<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">text in 007 fix the problem?<o:=
p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">[312:30] After &quot;any design=
ator&quot;, add &quot; with the POINTER attribute or &quot;<o:p></o:p></spa=
n></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">Cheers<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">Reinhold<o:p></o:p></span></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</body>
</html>

--_000_b14b65f86e6c40acafdc56e94998d4bdBADWLRZSW13MB1adsmwnde_--
