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

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 3 21:17:45 PDT 2020


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

            Bug ID: 45425
           Summary: Wrong line table information at -Og
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: ditaliano at apple.com
                CC: aprantl at apple.com, dblaikie at gmail.com,
                    echristo at gmail.com, jdevlieghere at apple.com,
                    jeremy.morse.llvm at gmail.com, keith.walker at arm.com,
                    llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com, vsk at apple.com

$ cat a.c

int a;
int b(char c) {
  return (a >= 2 || c >> a)
             ? c
             : 0;
}
int
main()
{
  return b(0);
}

$ ./clang --version
clang version 11.0.0 (https://github.com/llvm/llvm-project
b7397e81fe4dee8ffd4a1353bf0cf3a7d2ed267b)
Target: x86_64-apple-darwin18.6.0
Thread model: posix
InstalledDir: /Users/dcci/work/llvm-mono/build-release/bin/.

$  ./lldb --version
lldb version 11.0.0
  clang revision b7397e81fe4dee8ffd4a1353bf0cf3a7d2ed267b
  llvm revision b7397e81fe4dee8ffd4a1353bf0cf3a7d2ed267b

To reproduce, set a breakpoint in main, and keep stepping through `s`.
Eventually, you'll hit line `4`, despite the conditions are both false, i.e.

* thread #1, queue = 'com.apple.main-thread', stop reason = step in
    frame #0: 0x0000000100000f7a a`b(c='\0') at a.c:4:16 [opt]
   1    int a;
   2    int b(char c) {
   3      return (a >= 2 || c >> a)
-> 4                 ? c
   5                 : 0;
   6    }
   7    int
(lldb) p (a >= 2)
(bool) $0 = false
(lldb) p (bool)(c >> a)
(bool) $1 = false

-- 
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/20200404/7d1ea701/attachment-0001.html>


More information about the llvm-bugs mailing list