<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 - Wrong line and backtrace information at Og"
   href="https://bugs.llvm.org/show_bug.cgi?id=51511">51511</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Wrong line and backtrace information at Og
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </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>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>DebugInfo
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>artuso@diag.uniroma1.it
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Comment:
When Stepping on the nop assembly instruction, the source line (line 4) and the
backtrace (main) are wrong.

Steps to reproduce bug:

root@cbf0f3763b8d:/home/stepping/output# clang -v
clang version 14.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
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@cbf0f3763b8d:/home/stepping/output# lldb -v
lldb version 14.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a> revision
957334382cd12ec07b46c0ddfdcc220731f6d80f)
  clang revision 957334382cd12ec07b46c0ddfdcc220731f6d80f
  llvm revision 957334382cd12ec07b46c0ddfdcc220731f6d80f

root@cbf0f3763b8d:/home/stepping/output# cat -n a.c
     1       volatile int a,  g_5108          ;
     2                     int b;
     3  short c()               {
     4                                 return g_5108;
     5                             }
     6         int main () {
     7                         c();
     8                         b = 0;
     9                         for (;
    10                     b < 4;
    11                     b++)                   a ;
    12                     }

root@cbf0f3763b8d:/home/stepping/output# cat a.c
     volatile int a,  g_5108          ;
                   int b;
short c()               {
                               return g_5108;
                           }
       int main () {
                       c();
                       b = 0;
                       for (;
                   b < 4;
                   b++)                   a ;
                   }
root@cbf0f3763b8d:/home/stepping/output# clang -Og -g -Wno-everything -o optg
a.c

root@cbf0f3763b8d:/home/stepping/output# lldb optg
(lldb) target create "optg"
Current executable set to '/home/stepping/output/optg' (x86_64).
(lldb) b 0x40049b
Breakpoint 1: address = 0x000000000040049b
(lldb) r
Process 48 launched: '/home/stepping/output/optg' (x86_64)
Process 48 exited with status = 0 (0x00000000)
(lldb) b 0x40049b
Breakpoint 2: where = optg`main + 11 at a.c:4:39, address = 0x000000000040049b
(lldb) r
Process 56 launched: '/home/stepping/output/optg' (x86_64)
Process 56 stopped
* thread #1, name = 'optg', stop reason = breakpoint 2.1
    frame #0: 0x000000000040049b optg`main at a.c:4:39
   1         volatile int a,  g_5108          ;
   2                       int b;
   3    short c()               {
-> 4                                   return g_5108;
   5                               }
   6           int main () {
   7                           c();
(lldb) di -l
optg`main:
    0x400490 <+0>:  movl   0x200b96(%rip), %eax      ; g_5108
    0x400496 <+6>:  movl   $0x4, %eax
->  0x40049b <+11>: nopl   (%rax,%rax)
(lldb) bt
* thread #1, name = 'optg', stop reason = breakpoint 2.1
  * frame #0: 0x000000000040049b optg`main at a.c:4:39
    frame #1: 0x00007ffff7a03bf7 libc.so.6`__libc_start_main + 231
    frame #2: 0x00000000004003ba optg`_start + 42</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>