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

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 20 02:51:09 PDT 2020


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

            Bug ID: 46002
           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: ditaliano at apple.com, jdevlieghere at apple.com,
                    keith.walker at arm.com, llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com

Line information is wrong for line 17. 

$ cat amod.c 
int a ;
static int *b ;
char c;
void __assert_fail () __attribute__ ((__noreturn__));
static short d() {
    b = a
    ;
}

int main () 
{
     d();
     {
          int p_14,  p_11  ;
          if (2  ^ c)     ;
          else     
              ((p_14 == &p_11) ? (void) (0) : __assert_fail ("p_14 == &p_11",
"a.c", 131, __func__));
      }
}

$ 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 amod.c

$ lldb opt
(lldb) target create "opt"
Current executable set to 'opt' (x86_64).
(lldb) b main 
Breakpoint 1: where = opt`main + 1 at amod.c:12:6, address = 0x00000000004004e1
(lldb) r
Process 64 launched: 'opt' (x86_64)
Process 64 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.1
    frame #0: 0x00000000004004e1 opt`main at amod.c:12:6
   9    
   10   int main () 
   11   {
-> 12        d();
   13        {
   14             int p_14,  p_11  ;
   15             if (2  ^ c)     ;
(lldb) s
Process 64 stopped
* thread #1, name = 'opt', stop reason = step in
    frame #0: 0x0000000000400510 opt`d at amod.c:17:47
   14             int p_14,  p_11  ;
   15             if (2  ^ c)     ;
   16             else     
-> 17                 ((p_14 == &p_11) ? (void) (0) : __assert_fail ("p_14 ==
&p_11", "a.c", 131, __func__));
   18         }
   19   }
(lldb) bt
* thread #1, name = 'opt', stop reason = step in
  * frame #0: 0x0000000000400510 opt`d at amod.c:17:47
    frame #1: 0x00000000004004e6 opt`main at amod.c:12:6
    frame #2: 0x00007ffff7a05b97 libc.so.6`__libc_start_main + 231
    frame #3: 0x000000000040041a opt`_start + 42
(lldb) di
opt`d:
->  0x400510 <+0>: retq   
(lldb) 

$ gdb opt
(gdb) b main
Breakpoint 1 at 0x4004e1: file amod.c, line 12.
(gdb) s
The program is not being run.
(gdb) r
Starting program: opt 

Breakpoint 1, main () at amod.c:12
12           d();
(gdb) s
0x0000000000400510 in d () at amod.c:17
17                    ((p_14 == &p_11) ? (void) (0) : __assert_fail ("p_14 ==
&p_11", "a.c", 131, __func__));
(gdb)

-- 
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/20200520/bc9cec6e/attachment.html>


More information about the llvm-bugs mailing list