[llvm-bugs] [Bug 45895] New: Wrong Line Information at O1

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 13 02:25:39 PDT 2020


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

            Bug ID: 45895
           Summary: Wrong Line Information at O1
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: massarelli at diag.uniroma1.it
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    ditaliano at apple.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Line 9 should not be hit during debugging.

$ cat a.c
char a;
int b;
void  c(    d)
    {
      int si1 = a,  si2 = d;
        b = 
          si1 > si2 || si2 > si1 < si2  ?
          0 :
          si1 * si2;
    }
int main ()
    {
        c(    80);
    }

$ clang -v
clang version 11.0.0 (https://github.com/llvm/llvm-project.git
c25b20c0f6c13d68dbc2e185764082d61ae4a132)
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
Found candidate GCC installation:
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/11.0.0
Selected GCC installation: /usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/11.0.0
Candidate multilib: .;@m64
Selected multilib: .;@m64

$ lldb -v
lldb version 11.0.0
  clang revision c25b20c0f6c13d68dbc2e185764082d61ae4a132
  llvm revision c25b20c0f6c13d68dbc2e185764082d61ae4a132

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

$ lldb opt
(lldb) target create "opt"
Current executable set to 'opt' (x86_64).
(lldb) b -l 9
Breakpoint 1: where = opt`c + 19 at a.c:9:15, address = 0x00000000004004b3
(lldb) r
Process 229 launched: 'opt' (x86_64)
Process 229 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.1
    frame #0: 0x00000000004004b3 opt`c(d=80) at a.c:9:15
   6            b = 
   7              si1 > si2 || si2 > si1 < si2  ?
   8              0 :
-> 9              si1 * si2;
   10       }
   11   int main ()
   12       {
(lldb) p si1
(int) $0 = 0
(lldb) p si2
(int) $1 = 80
(lldb) expr si1 > si2 || si2 > si1 < si2
(bool) $2 = true
(lldb) s
Process 229 stopped
* thread #1, name = 'opt', stop reason = step in
    frame #0: 0x00000000004004b8 opt`c(d=80) at a.c:7:34
   4        {
   5          int si1 = a,  si2 = d;
   6            b = 
-> 7              si1 > si2 || si2 > si1 < si2  ?
   8              0 :
   9              si1 * si2;
   10       }
(lldb) s
Process 229 stopped
* thread #1, name = 'opt', stop reason = step in
    frame #0: 0x00000000004004bd opt`c(d=80) at a.c:6:11
   3    void  c(    d)
   4        {
   5          int si1 = a,  si2 = d;
-> 6            b = 
   7              si1 > si2 || si2 > si1 < si2  ?
   8              0 :
   9              si1 * si2;
(lldb) s
Process 229 stopped
* thread #1, name = 'opt', stop reason = step in
    frame #0: 0x00000000004004c3 opt`c(d=80) at a.c:10:5
   7              si1 > si2 || si2 > si1 < si2  ?
   8              0 :
   9              si1 * si2;
-> 10       }
   11   int main ()
   12       {
   13           c(    80);
(lldb) s
Process 229 stopped
* thread #1, name = 'opt', stop reason = step in
    frame #0: 0x00000000004004db opt`main at a.c:14:5
   11   int main ()
   12       {
   13           c(    80);
-> 14       }
(lldb) s

-- 
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/20200513/b107c73c/attachment.html>


More information about the llvm-bugs mailing list