<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Including Paul and llvm-dev.<br>
    </p>
    <div class="moz-cite-prefix">On 8/27/18 12:31 PM, Victor Leschuk
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:ee600c3a-1f2f-f5cc-80a2-f9a397295cd7@accesssoftek.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <p>David, Adrian, could you please advise on this one?<br>
      </p>
      <div class="moz-cite-prefix">On 8/27/18 12:24 PM, via llvm-bugs
        wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:bug-38714-206@http.bugs.llvm.org%2F">
        <meta http-equiv="Content-Type" content="text/html;
          charset=UTF-8">
        <base href="https://bugs.llvm.org/">
        <table cellspacing="0" cellpadding="8" border="1">
          <tbody>
            <tr>
              <th>Bug ID</th>
              <td><a class="bz_bug_link &#xA; bz_status_NEW " title="NEW
                  -&#xA; [DebugInfo] [DWARF] [AArch64] .debug_loc entry
                  missing&#xA; in optimized build on aarch64"
                  href="https://bugs.llvm.org/show_bug.cgi?id=38714"
                  moz-do-not-send="true">38714</a> </td>
            </tr>
            <tr>
              <th>Summary</th>
              <td>[DebugInfo] [DWARF] [AArch64] .debug_loc entry missing
                in optimized build on aarch64 </td>
            </tr>
            <tr>
              <th>Product</th>
              <td>new-bugs </td>
            </tr>
            <tr>
              <th>Version</th>
              <td>trunk </td>
            </tr>
            <tr>
              <th>Hardware</th>
              <td>PC </td>
            </tr>
            <tr>
              <th>OS</th>
              <td>Linux </td>
            </tr>
            <tr>
              <th>Status</th>
              <td>NEW </td>
            </tr>
            <tr>
              <th>Severity</th>
              <td>normal </td>
            </tr>
            <tr>
              <th>Priority</th>
              <td>P </td>
            </tr>
            <tr>
              <th>Component</th>
              <td>new bugs </td>
            </tr>
            <tr>
              <th>Assignee</th>
              <td><a class="moz-txt-link-abbreviated"
                  href="mailto:unassignedbugs@nondot.org"
                  moz-do-not-send="true">unassignedbugs@nondot.org</a> </td>
            </tr>
            <tr>
              <th>Reporter</th>
              <td><a class="moz-txt-link-abbreviated"
                  href="mailto:vleschuk@accesssoftek.com"
                  moz-do-not-send="true">vleschuk@accesssoftek.com</a> </td>
            </tr>
            <tr>
              <th>CC</th>
              <td><a class="moz-txt-link-abbreviated"
                  href="mailto:llvm-bugs@lists.llvm.org"
                  moz-do-not-send="true">llvm-bugs@lists.llvm.org</a> </td>
            </tr>
          </tbody>
        </table>
        <p> </p>
        <div>
          <pre>Created <span class=""><a href="attachment.cgi?id=20771" name="attach_20771" title="Source, object file and generated assembly." moz-do-not-send="true">attachment 20771</a> <a href="attachment.cgi?id=20771&action=edit" title="Source, object file and generated assembly." moz-do-not-send="true">[details]</a></span>
Source, object file and generated assembly.

When compiling the following sample with optimizations enabled (-O1 and higher)
it looks like a .debug_loc entry is missing for argc:

#include <stdio.h>

int main( int argc, char **argv )
{
  for(int i = 1; i < argc; ++i) {
    printf("Argument %d: %s\n", i, argv[i]);
  }
  return 0;
}

$ clang -target aarch64-unknown-linux -c -g -O1 -o test.o test.c

There are the following entries:

0x00000043:     DW_TAG_formal_parameter [3]  
                  DW_AT_location [DW_FORM_sec_offset]   (0x00000000
                     [0x0000000000000000,  0x0000000000000034): DW_OP_reg0 W0)
                  DW_AT_name [DW_FORM_strp]     ( .debug_str[0x000000d5] =
"argc")

0x00000052:     DW_TAG_formal_parameter [3]  
                  DW_AT_location [DW_FORM_sec_offset]   (0x00000023
                     [0x0000000000000000,  0x0000000000000020): DW_OP_reg1 W1
                     [0x0000000000000020,  0x0000000000000048): DW_OP_reg19
W19)
                  DW_AT_name [DW_FORM_strp]     ( .debug_str[0x000000da] =
"argv")


The assembly for the code is the following:

        //DEBUG_VALUE: main:argc <- $w0
        //DEBUG_VALUE: main:argv <- $x1
.Ltmp0:
        //DEBUG_VALUE: i <- 1
        .loc    1 5 3 prologue_end      // test.c:5:3
        cmp     w0, #2                  // =2
        b.lt    .LBB0_3
.Ltmp1:
// %bb.1:                               // %for.body.preheader
        //DEBUG_VALUE: main:argv <- $x1
        //DEBUG_VALUE: main:argc <- $w0
        .loc    1 0 3 is_stmt 0         // test.c:0:3
        adrp    x21, .L.str
        mov     x19, x1
.Ltmp2:
        //DEBUG_VALUE: main:argv <- $x19
        mov     w22, w0

It looks like there should be two DW_OP_reg* records for w0 and for w22 for
argc.

Correct me if I am wrong.

PS x86 doesn't seem to have this problem.</pre>
        </div>
        <hr> <span>You are receiving this mail because:</span>
        <ul>
          <li>You are on the CC list for the bug.</li>
        </ul>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <pre class="moz-quote-pre" wrap="">_______________________________________________
llvm-bugs mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-bugs@lists.llvm.org" moz-do-not-send="true">llvm-bugs@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs" moz-do-not-send="true">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs</a>
</pre>
      </blockquote>
      <pre class="moz-signature" cols="72">-- 
Best Regards,

Victor Leschuk | Software Engineer | Access Softek</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Best Regards,

Victor Leschuk | Software Engineer | Access Softek</pre>
  </body>
</html>