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

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Feb 23 15:15:44 PST 2019


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

            Bug ID: 40836
           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 outer.c
void optimize_me_not() {}

$ cat 3.c
int b;
char c;
int(a)() { return b; }
char d(p_21) {
e : {
  int f;
  p_21;
  if (a())
    ;
  else {
    optimize_me_not();
    return 1;
  }
  for (; c;) {
    p_21 = 0;
    goto e;
  }
}
}
int main() { d(8); }

### -O0

$ lldb-trunk ./a.out
(lldb) target create "./a.out"
Current executable set to './a.out' (x86_64).
(lldb) br set -p optimize_me_not
Breakpoint 1: where = a.out`d + 30 at 3.c:11:5, address = 0x00000000004004ae
(lldb) r
Process 10883 launched: '/home/davide/finished_reducing/a.out' (x86_64)
Process 10883 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x00000000004004ae a.out`d(p_21=8) at 3.c:11:5
   8      if (a())
   9        ;
   10     else {
-> 11       optimize_me_not();
   12       return 1;
   13     }
   14     for (; c;) {
(lldb) p p_21
(int) $0 = 8


### -O1

(lldb) br set -p optimize_me_not
Breakpoint 1: where = a.out`d + 34 at 3.c:11:5, address = 0x00000000004004b2
(lldb) r
Process 8803 launched: '/home/davide/finished_reducing/a.out' (x86_64)
Process 8803 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x00000000004004b2 a.out`d(p_21=0) at 3.c:11:5
   8      if (a())
   9        ;
   10     else {
-> 11       optimize_me_not();
   12       return 1;
   13     }
   14     for (; c;) {
(lldb) p p_21
(int) $0 = 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/20190223/d2f10650/attachment.html>


More information about the llvm-bugs mailing list