Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Wrong line information at Og #50479

Open Quuxplusone opened 3 years ago

Quuxplusone commented 3 years ago
Bugzilla Link PR51512
Status CONFIRMED
Importance P enhancement
Reported by Fiorella Artuso (artuso@diag.uniroma1.it)
Reported on 2021-08-17 08:45:24 -0700
Last modified on 2021-08-24 16:14:13 -0700
Version trunk
Hardware PC Linux
CC ditaliano@apple.com, jdevlieghere@apple.com, jeremy.morse.llvm@gmail.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
Comment:
Step at variable declaration (line 6).

Steps to reproduce bug:

root@5cd8c077ddd7:/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@5cd8c077ddd7:/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@5cd8c077ddd7:/home/stepping/output# cat a.c
int a, c, e, f;
static int *b = &a;
short d = 6;
void func_15() {
  for (; c >= 0; c--) {
    int i, j;
    *b = f;
  }
}
int main() {
  func_15();
  for (; d <= 0;) {
    int g[4];
    g[e] = &b;
  }
}
root@5cd8c077ddd7:/home/stepping/output# cat -n a.c
     1  int a, c, e, f;
     2  static int *b = &a;
     3  short d = 6;
     4  void func_15() {
     5    for (; c >= 0; c--) {
     6      int i, j;
     7      *b = f;
     8    }
     9  }
    10  int main() {
    11    func_15();
    12    for (; d <= 0;) {
    13      int g[4];
    14      g[e] = &b;
    15    }
    16  }

root@5cd8c077ddd7:/home/stepping/output# clang -g -Og a.c -o opt
a.c:14:10: warning: incompatible pointer to integer conversion assigning to
'int' from 'int **' [-Wint-conversion]
    g[e] = &b;
         ^ ~~
1 warning generated.

root@5cd8c077ddd7:/home/stepping/output# lldb opt
(lldb) target create "opt"
Current executable set to '/home/stepping/output/opt' (x86_64).
(lldb) b 6
Breakpoint 1: 2 locations.
(lldb) r
Process 38586 launched: '/home/stepping/output/opt' (x86_64)
Process 38586 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.2
    frame #0: 0x00000000004004e0 opt`main [inlined] func_15 at a.c:6:9
   3    short d = 6;
   4    void func_15() {
   5      for (; c >= 0; c--) {
-> 6        int i, j;
   7        *b = f;
   8      }
   9    }
(lldb) di -l
opt`main:
->  0x4004e0 <+32>: movl   %ecx, %edx
Quuxplusone commented 3 years ago

lldb should never step on a declaration, the line table is probably wrong.