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

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Feb 26 09:52:44 PST 2019


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

            Bug ID: 40871
           Summary: Wrong debug info generated at -O3 (-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: cmtice at google.com, dblaikie at gmail.com,
                    echristo at gmail.com, jeremy.morse.llvm at gmail.com,
                    llvm-bugs at lists.llvm.org, vsk at apple.com

$ cat outer.c
optimize_me_not() {}

$ cat a.c
int main() {
  int k = 0;
  for (; k < 1; k++)
    ;
  optimize_me_not();
}


### -O0

(lldb) r
Process 7046 launched: '/home/davide/LLDB-testing/reduce/a.out' (x86_64)
Process 7046 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x00000000004004b3 a.out`main at abc.c:5:3
   2      int k = 0;
   3      for (; k < 1; k++)
   4        ;
-> 5      optimize_me_not();
   6    }
(lldb) frame var k
(int) k = 1

### -O3

Current executable set to './a.out' (x86_64).
(lldb) br set -p optimize_me_not
Breakpoint 1: where = a.out`main + 1 at abc.c:5:3, address = 0x0000000000400481
(lldb) r
Process 20271 launched: '/home/davide/LLDB-testing/reduce/a.out' (x86_64)
Process 20271 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x0000000000400481 a.out`main at abc.c:5:3
   2      int k = 0;
   3      for (; k < 1; k++)
   4        ;
-> 5      optimize_me_not();
   6    }
(lldb) frame var k
(int) k = 0

-- 
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/20190226/3d074a03/attachment.html>


More information about the llvm-bugs mailing list