<html 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)">
<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:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
span.EmailStyle18
        {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:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi, Sourabh.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">We've confirmed the bug. It can be worked around by removing the VALUE attribute.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Can you file an issue for us on the (current) Flang GitHub site?<o:p></o:p></p>
<p class="MsoNormal"><a href="https://github.com/flang-compiler/flang/issues">https://github.com/flang-compiler/flang/issues</a><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thank you.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On 3/24/20, 12:52 PM, "flang-dev on behalf of Sourabh Singh Tomar via flang-dev" <<a href="mailto:flang-dev-bounces@lists.llvm.org">flang-dev-bounces@lists.llvm.org</a> on behalf of
<a href="mailto:flang-dev@lists.llvm.org">flang-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<table class="MsoNormalTable" border="1" cellpadding="0" style="background:#FFEB9C">
<tbody>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><b><span style="font-size:7.5pt;font-family:"Verdana",sans-serif;color:black">External email: Use caution opening links or attachments</span></b><span style="font-size:7.5pt;font-family:"Verdana",sans-serif;color:black">
</span><o:p></o:p></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">Hello Everyone, <o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">For a typical Fortran program compiled with flang with -g(debuginfo enabled), I'm noticing *DW_TAG_lexical_block* is getting created as child of the *DW_TAG_subprogram*.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">As a consequence of this debuggers like GDB  is not able to show the arguments of the subprogram.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Program snippet -<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">subroutine sub(foo)<br>
        integer, value :: foo<br>
        print*,foo<br>
      end subroutine<br>
program main<br>
      interface<br>
        subroutine sub(a)<br>
              integer, value :: a<br>
         end subroutine<br>
      end interface<br>
             call sub(11)<br>
 end program<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">--------------------------------<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Snippet from GDB --<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Breakpoint 1, sub () at test.f90:1<br>
1             subroutine sub(foo)<br>
(gdb) info args<br>
No arguments.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">-----------------------------------<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Furthermore, *DW_TAG_formal_parameter* is created as a child of this *DW_TAG_lexical_scope*. Hence GDB is showing arguments of the subprogram as locals variables. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Snippet DWARF--<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">0x0000002f:   DW_TAG_subprogram<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">DW_AT_name      ("sub")<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> DW_AT_low_pc    (0x00000000004011b0)<br>
 DW_AT_high_pc   (0x0000000000401245<br>
.....<br>
0x00000049:     DW_TAG_lexical_block<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> DW_AT_low_pc    (0x00000000004011b0)<br>
 DW_AT_high_pc   (0x0000000000401245<br>
 ....<br>
0x0000005a:       DW_TAG_formal_parameter<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">  DW_AT_name      ("foo")  <o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">0x0000005a:       DW_TAG_variable<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">  DW_AT_name      ("foo")  <o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal">...<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">---------------------------------------<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Is this behavior intended ?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Anyone working on this area, Please share your understanding on this!<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">*Please note here that same hierarchy of debug info is also present at LLVM IR level, hence the final DWARF is shared here. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thank You,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Sourabh.<o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>

<DIV>
<HR>
</DIV>
<DIV>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. </DIV>
<DIV>
<HR>
</DIV>
</body>
</html>