[llvm-bugs] [Bug 51751] New: Wrong mapping assembly-line at Og

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Sep 4 08:50:26 PDT 2021


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

            Bug ID: 51751
           Summary: Wrong mapping assembly-line at Og
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: artuso at diag.uniroma1.it
                CC: jdevlieghere at apple.com, keith.walker at arm.com,
                    llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com

Comment:
The debugger wrongly associates the mov instruction "0x40049a <+10>: movw $0x0,
0x200b89(%rip)" to line 6, which is the call to func_1, instead of line 3 which
is the actual assignment.

Steps to reproduce bug:

root at 69ab245e01ef:/home/stepping/output# clang -v
clang version 14.0.0 (https://github.com/llvm/llvm-project.git
957334382cd12ec07b46c0ddfdcc220731f6d80f)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
root at 69ab245e01ef:/home/stepping/output# lldb -v
lldb version 14.0.0 (https://github.com/llvm/llvm-project.git revision
957334382cd12ec07b46c0ddfdcc220731f6d80f)
  clang revision 957334382cd12ec07b46c0ddfdcc220731f6d80f
  llvm revision 957334382cd12ec07b46c0ddfdcc220731f6d80f
root at 69ab245e01ef:/home/stepping/output# cat a.c
short a;
int b;
void func_1() { a = 0; }
int main() {
  b = 0;
  func_1();
}
root at 69ab245e01ef:/home/stepping/output# cat -n a.c
     1  short a;
     2  int b;
     3  void func_1() { a = 0; }
     4  int main() {
     5    b = 0;
     6    func_1();
     7  }
root at 69ab245e01ef:/home/stepping/output# clang -Og -g -Wno-everything -o opt
a.c
root at 69ab245e01ef:/home/stepping/output# lldb opt
(lldb) target create "opt"
Current executable set to '/home/stepping/output/opt' (x86_64).
(lldb) b main
Breakpoint 1: where = opt`main at a.c:5:5, address = 0x0000000000400490
(lldb) r
Process 55 launched: '/home/stepping/output/opt' (x86_64)
Process 55 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.1
    frame #0: 0x0000000000400490 opt`main at a.c:5:5
   2    int b;
   3    void func_1() { a = 0; }
   4    int main() {
-> 5      b = 0;
   6      func_1();
   7    }
(lldb) si
Process 55 stopped
* thread #1, name = 'opt', stop reason = instruction step into
    frame #0: 0x000000000040049a opt`main at a.c:6:3
   3    void func_1() { a = 0; }
   4    int main() {
   5      b = 0;
-> 6      func_1();
   7    }
(lldb) di -l
opt`main:
->  0x40049a <+10>: movw   $0x0, 0x200b89(%rip)      ; completed.7698

   5      b = 0;
   6      func_1();
** 7    }

    0x4004a3 <+19>: xorl   %eax, %eax
    0x4004a5 <+21>: retq
    0x4004a6:       nopw   %cs:(%rax,%rax)
opt`__libc_csu_init:
    0x4004b0 <+0>:  pushq  %r15
    0x4004b2 <+2>:  pushq  %r14
    0x4004b4 <+4>:  movq   %rdx, %r15
    0x4004b7 <+7>:  pushq  %r13

-- 
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/20210904/8ddfc47b/attachment.html>


More information about the llvm-bugs mailing list