[llvm-bugs] [Bug 46122] New: Wrong line information at Og

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 28 06:25:11 PDT 2020


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

            Bug ID: 46122
           Summary: Wrong line information at Og
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: massarelli 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

Line 10 is hit multiple times, but there is no loop or inlining.

$ cat -n a.c
     1  int a;
     2  static int *b;
     3  static int **c = &b;
     4  void __assert_fail();
     5  static int func_7() {
     6    int *d = &a;
     7    *c = d;
     8    b ? (void)0 : __assert_fail();
     9  }
    10  int main() { func_7(); }


$ cat a.c
int a;
static int *b;
static int **c = &b;
void __assert_fail();
static int func_7() {
  int *d = &a;
  *c = d;
  b ? (void)0 : __assert_fail();
}
int main() { func_7(); }

$ clang -v
clang version 11.0.0 (https://github.com/llvm/llvm-project.git
268fa40daa151d3b4bff1df12b62e5dae94685d7)
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

$ lldb -v
lldb version 11.0.0
  clang revision 268fa40daa151d3b4bff1df12b62e5dae94685d7
  llvm revision 268fa40daa151d3b4bff1df12b62e5dae94685d7

$ clang -Og -g -o opt a.c

$ lldb opt
(lldb) target create "opt"
Current executable set to 'opt' (x86_64).
(lldb) b main
Breakpoint 1: where = opt`main + 1 at a.c:10:14, address = 0x0000000000400481
(lldb) r
Process 179 launched: 'opt' (x86_64)
Process 179 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.1
    frame #0: 0x0000000000400481 opt`main at a.c:10:14
   7      *c = d;
   8      b ? (void)0 : __assert_fail();
   9    }
-> 10   int main() { func_7(); }
(lldb) s
Process 179 stopped
* thread #1, name = 'opt', stop reason = step in
    frame #0: 0x0000000000400490 opt`func_7 at a.c:10:24
   7      *c = d;
   8      b ? (void)0 : __assert_fail();
   9    }
-> 10   int main() { func_7(); }
(lldb) s
Process 179 stopped
* thread #1, name = 'opt', stop reason = step in
    frame #0: 0x0000000000400486 opt`main at a.c:10:24
   7      *c = d;
   8      b ? (void)0 : __assert_fail();
   9    }
-> 10   int main() { func_7(); }
(lldb)

-- 
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/20200528/52f5a8cf/attachment.html>


More information about the llvm-bugs mailing list