<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)">
<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:Aptos;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:12.0pt;
        font-family:"Aptos",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#467886;
        text-decoration:underline;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Aptos",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
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-US" link="#467886" vlink="#96607D" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">The spec does say they occur in the same order, which strongly implies that there is a DW_TAG_call_site_parameter for each actual parameter. Although, now that I say that, I have a memory of some discussion
 where a parameter entry might be omitted entirely. I don’t remember the details, but Jakub probably does. The spec does not clearly say that parameter entries can be omitted, though.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">--paulr<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Sergey <spevnev16@gmail.com>
<br>
<b>Sent:</b> Friday, June 14, 2024 1:12 PM<br>
<b>To:</b> dwarf-discuss@lists.dwarfstd.org; Robinson, Paul <paul.robinson@sony.com><br>
<b>Subject:</b> RE: [Dwarf-discuss] Request for clarification of handling stack-passed parameters<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div name="messageBodySection">
<div>
<p class="MsoNormal">In that case I shall create appropriate issues for the mentioned compilers in order to discuss the matter with them.<br>
<br>
I think I have found another issue with clang. In some cases it does not generate middle parameters: namely, it skipped the 2nd one yet included the 3rd one.<br>
It believe it does not match the standard (p91 line 6-7): "Call site parameter entries occur in the same order as the corresponding parameters in the source.", does it?<o:p></o:p></p>
</div>
</div>
<div name="messageReplySection">
<p class="MsoNormal">On Jun 14, 2024, 15:11 +0300, Robinson, Paul <<a href="mailto:paul.robinson@sony.com">paul.robinson@sony.com</a>>, wrote:<br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">I believe this is an issue with the implementations, although it is a bit odd that both gcc and clang behave the same way. There should be a DW_TAG_call_site_parameter
 for each parameter. DW_AT_location should describe the stack slot where the parameter is passed. It should not be a problem for the compiler to do that, the location description would be evaluated in the context of the caller.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">--paulr</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b>
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Dwarf-discuss <<a href="mailto:dwarf-discuss-bounces+paul.robinson=sony.com@lists.dwarfstd.org">dwarf-discuss-bounces+paul.robinson=sony.com@lists.dwarfstd.org</a>>
<b>On Behalf Of</b> Sergey via Dwarf-discuss<br>
<b>Sent:</b> Wednesday, June 12, 2024 9:57 AM<br>
<b>To:</b> <a href="mailto:dwarf-discuss@lists.dwarfstd.org">dwarf-discuss@lists.dwarfstd.org</a><br>
<b>Subject:</b> [Dwarf-discuss] Request for clarification of handling stack-passed parameters</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<div name="messageBodySection">
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"># Request for clarification of handling stack-passed parameters<br>
<br>
## Background<br>
<br>
I came across this while parsing parameters of a variadic function in C. Formal parameters are not sufficient for my case, since all the variadic arguments are described with a single `DW_TAG_unspecified_parameters`, whereas reading `DW_TAG_call_site_parameter`
 allows to get their locations and values.<br>
<br>
## Overview<br>
<br>
When generating a DWARF5 of a C function with **more than 6** parameters, the generated `DW_TAG_call_site` contains only **first 6** `DW_TAG_call_site_parameter`s (function's `DW_TAG_formal_parameter`s contain all of them).<br>
<br>
Something I have noticed is that the parameters, which do not get `DW_TAG_call_site_parameter` generated, are all **passed through stack**(whereas first 6 through registers), as evident by function's `DW_TAG_formal_parameter`'s `DW_AT_location` containing `DW_OP_fbreg`.<br>
<br>
## Request for clarification<br>
<br>
It happens both with gcc and clang, however I was unable to find any information in the standard regarding generation of only registed-passed parameters.<br>
<br>
I request clarification on whether it is an issue with implementations, or is there something in the standard which justifies the described behaviour.<o:p></o:p></p>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</body>
</html>