<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [DebugInfo] [DWARF] [AArch64] .debug_loc entry missing in optimized build on aarch64"
   href="https://bugs.llvm.org/show_bug.cgi?id=38714">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>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>vleschuk@accesssoftek.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=20771" name="attach_20771" title="Source, object file and generated assembly.">attachment 20771</a> <a href="attachment.cgi?id=20771&action=edit" title="Source, object file and generated assembly.">[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>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>