[llvm-bugs] [Bug 40944] New: Wrong debug info generated at -O1 (-O0 is correct)

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Mar 3 20:34:20 PST 2019


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

            Bug ID: 40944
           Summary: Wrong debug info generated at -O1 (-O0 is correct)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Keywords: wrong-debug
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: davide at freebsd.org
                CC: llvm-bugs at lists.llvm.org

$ cat 1.c
unsigned char a;
char b = -1;
int main() {
  int l_135 = 1102062129;
  l_135 = (a = b) | 9;
  optimize_me_not();
}

$ cat outer.c
void optimize_me_not() {}

### -O0

* thread #1, name = 'a.out', stop reason = breakpoint 2.1
    frame #0: 0x00000000004004a6 a.out`main at 1.c:6:3
   3    int main() {
   4      int l_135 = 1102062129;
   5      l_135 = (a = b) | 9;
-> 6      optimize_me_not();
   7    }
(lldb) frame var
(int) l_135 = 255

### -O1

* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x000000000040048d a.out`main at 1.c:6:3
   3    int main() {
   4      int l_135 = 1102062129;
   5      l_135 = (a = b) | 9;
-> 6      optimize_me_not();
   7    }
(lldb) frame var
(lldb) frame var l_135
(int) l_135 = 1102062129


$ clang-trunk --version
clang version 9.0.0 (trunk 355281)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin

$ lldb-trunk --version
lldb version 9.0.0 (https://llvm.org/svn/llvm-project/lldb/trunk revision
355281)
  clang revision 355281
  llvm revision 355281

-- 
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/20190304/db3d2835/attachment.html>


More information about the llvm-bugs mailing list