<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><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:12.0pt;
        font-family:"Calibri",sans-serif;}
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;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">So, do we know when this will be implemented.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">If there is no plan to someone  implement it any time soon.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Can I do the work, as I need this to finish the Block Data checks?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Carol<o:p></o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="color:black">From: </span></b><span style="color:black">Timothy Keith <tkeith@nvidia.com><br>
<b>Date: </b>Friday, 6 December 2019 at 16:59<br>
<b>To: </b>Caroline Concatto <Caroline.Concatto@arm.com>, "flang-dev@lists.llvm.org" <flang-dev@lists.llvm.org><br>
<b>Subject: </b>Re: [flang-dev] [f18]How to check if a variable was initialised in f18.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt">You are right, a variable initialized with a DATA statement should have an initial value returned by init() and that comes from DataStmtValue. That’s not implemented yet, whether the DATA statement is in a
 BLOCK DATA program unit or not.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Somewhere in resolve-names.cc we need to recognize DataStmtSet and walk through the lists of DataStmtObject and DataStmtValue and set the initialization of the objects from the values.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Tim</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="color:black">From: </span></b><span style="color:black">Caroline Concatto <Caroline.Concatto@arm.com><br>
<b>Date: </b>Friday, December 6, 2019 at 8:11 AM<br>
<b>To: </b>Timothy Keith <tkeith@nvidia.com>, "flang-dev@lists.llvm.org" <flang-dev@lists.llvm.org><br>
<b>Subject: </b>Re: [flang-dev] [f18]How to check if a variable was initialised in f18.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt">Hey,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">I have another question:</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">So I would imagine that a variable initialized  with DATA block could be checked  as: object-><span style="color:black">init().has_value()</span></span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">But this code :</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">BLOCK DATA DBAXES</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">      Integer ifail</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">      COMMON /CBAXES/I,J,K</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">      DATA I,J,K,ifail /1,2,3,4/</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">END BLOCK DATA</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">When I run does not accuse ifail as being initialized.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Looking at the code I can see that  if a variable is initialized as DATA it is only saved as  std::list<common::Indirection<parser::DataStmtValue>>, is this correct? I mean is my thought correct?</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Carol</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="color:black">From: </span></b><span style="color:black">Timothy Keith <tkeith@nvidia.com><br>
<b>Date: </b>Wednesday, 27 November 2019 at 15:32<br>
<b>To: </b>Caroline Concatto <Caroline.Concatto@arm.com>, "flang-dev@lists.llvm.org" <flang-dev@lists.llvm.org><br>
<b>Subject: </b>Re: [flang-dev] [f18]How to check if a variable was initialised in f18.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt">You’re getting a segmentation fault because not every symbols has ObjectEntityDetails (only those that represent objects do). So sometimes object is null. If you check for object being nullptr before dereferencing
 it your code wouldn’t crash.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">There are two other kinds of details that also have init(): ProcEntityDetails and TypeParamDetails. If you’re interested in initialization of those kinds of symbols as well, you’ll need to check for those
 using detailsIf or std::visit over the details of the symbol.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">One more thing: If you are only checking constraints and not doing things that affect what ends up in symbols, check-declarations.cc might be a better place for your change. resolve-names.cc is for building
 up the symbols and it checks constraints along the way. The checks in check-declarations.cc happen after that and are ones that can be done by just looking at the symbol table without any context from the parse tree.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Tim</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="color:black">From: </span></b><span style="color:black">flang-dev <flang-dev-bounces@lists.llvm.org> on behalf of Caroline Concatto via flang-dev <flang-dev@lists.llvm.org><br>
<b>Reply-To: </b>Caroline Concatto <Caroline.Concatto@arm.com><br>
<b>Date: </b>Wednesday, November 27, 2019 at 3:07 AM<br>
<b>To: </b>"flang-dev@lists.llvm.org" <flang-dev@lists.llvm.org><br>
<b>Subject: </b>[flang-dev] [f18]How to check if a variable was initialised in f18.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">Hi all,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">I don’t know if anyone can help. Probably with more info.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">But worth a shot, as a start.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">How do I check if a variable was initialized in F18 when my method only receives symbol? Is it possible?</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">I’ve tried the code bellow, but it gives me segmentation fault.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">//F18 function in resolve-names.cc</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">void ResolveNamesVisitor::FinishSpecificationPart() {</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">….</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">  for (auto &pair : currScope()) {</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">     auto &symbol{*pair.second};</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">     ….</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">     CheckInitialization(symbol);</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">  }</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">}</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">void DeclarationVisitor::CheckInitialization(const Symbol &symbol) {</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">          const auto *object{symbol.detailsIf<ObjectEntityDetails>()};</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">          if (object->init().has_value()) {</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">                       Say(symbol.name(),</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">                                     " Element '%s' was initialized"_err_en_US);</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">   }</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">}</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">By looking at the source code it looks like I need to reference to name, something like symbol.name(), but that does not work.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Thank you,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Carol</span><o:p></o:p></p>
<div>
<div class="MsoNormal" align="center" style="text-align:center"><span style="font-size:11.0pt">
<hr size="1" width="100%" align="center">
</span></div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">This email message is for the sole use of the intended recipient(s) and may contain confidential information.  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended
 recipient, please contact the sender by reply email and destroy all copies of the original message.
</span><o:p></o:p></p>
</div>
<div>
<div class="MsoNormal" align="center" style="text-align:center"><span style="font-size:11.0pt">
<hr size="1" width="100%" align="center">
</span></div>
</div>
</div>
</body>
</html>