[llvm-bugs] [Bug 38714] New: [DebugInfo] [DWARF] [AArch64] .debug_loc entry missing in optimized build on aarch64

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 27 02:24:39 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38714

            Bug ID: 38714
           Summary: [DebugInfo] [DWARF] [AArch64] .debug_loc entry missing
                    in optimized build on aarch64
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: vleschuk at accesssoftek.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 20771
  --> https://bugs.llvm.org/attachment.cgi?id=20771&action=edit
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180827/ea7d2d8c/attachment.html>


More information about the llvm-bugs mailing list