[llvm-bugs] [Bug 40834] New: Wrong debug info generated at -O1/-O2/-O3 (-O0 is correct)

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


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

            Bug ID: 40834
           Summary: Wrong debug info generated at -O1/-O2/-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: llvm-bugs at lists.llvm.org

$ cat 2.c
int a;
int *b = &a;
int main() {
  int c = *b;
  short l_504 = 1;
  if (c) {
    l_504 = -23;
    b = 0;
  }
  optimize_me_not();
}


$ cat outer.c
void optimize_me_not() {}

$ 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`main + 62 at 2.c:10:3, address = 0x00000000004004be
(lldb) r
Process 1246 launched: '/home/davide/finished_reducing/a.out' (x86_64)
Process 1246 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x00000000004004be a.out`main at 2.c:10:3
   7        l_504 = -23;
   8        b = 0;
   9      }
-> 10     optimize_me_not();
   11   }
(lldb) p l_504
(short) $0 = 1


(lldb) br set -p optimize_me_not
Breakpoint 1: where = a.out`main + 24 at 2.c:10:3, address = 0x0000000000400498
(lldb) r
Process 4538 launched: '/home/davide/finished_reducing/a.out' (x86_64)
Process 4538 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x0000000000400498 a.out`main at 2.c:10:3
   7        l_504 = -23;
   8        b = 0;
   9      }
-> 10     optimize_me_not();
   11   }
(lldb) p l_504
(short) $0 = -23

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


More information about the llvm-bugs mailing list