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: unassignedb...@nondot.org
          Reporter: dav...@freebsd.org
                CC: cmt...@google.com, dblai...@gmail.com,
                    echri...@gmail.com, jeremy.morse.l...@gmail.com,
                    llvm-bugs@lists.llvm.org, v...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to