[lldb-dev] [Bug 27257] New: Integer division expression not correctly evaluated

via lldb-dev lldb-dev at lists.llvm.org
Wed Apr 6 18:54:01 PDT 2016


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

            Bug ID: 27257
           Summary: Integer division expression not correctly evaluated
           Product: lldb
           Version: 3.8
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: tgfbeta at me.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 16180
  --> https://llvm.org/bugs/attachment.cgi?id=16180&action=edit
output with logging enabled.

In lldb bundled with Xcode 7.3 and Swift 2.2 Release for Ubuntu 14.04, integer
division expression is not correctly evaluated.

When debugging the following code:

$ cat /tmp/a.cpp 
#include <cstdio>
int main() {
    int b = 800;
    printf("%d\n", b);
    return 0;
}

$ clang -o /tmp/x -g /tmp/a.cpp

, integer division in expr is not evaluated correctly, while floating point
division seems to be good:

$ lldb /tmp/x
(lldb) target create "/tmp/x"
Current executable set to '/tmp/x' (x86_64).
(lldb) b 4
Breakpoint 1: where = x`main + 29 at a.cpp:4, address = 0x0000000100000f6d
(lldb) run
Process 46865 launched: '/tmp/x' (x86_64)
Process 46865 stopped
* thread #1: tid = 0x5e9061, 0x0000000100000f6d x`main + 29 at a.cpp:4, queue =
'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x0000000100000f6d x`main + 29 at a.cpp:4
   1       #include <cstdio>
   2       int main() {
   3           int b = 800;
-> 4           printf("%d\n", b);
   5           return 0;
   6       }
(lldb) p b / 1
(int) $0 = 0
(lldb) p b / 2
(int) $1 = 0
(lldb) p b / 6
(int) $2 = 1
(lldb) p b / 13
(int) $3 = 1
(lldb) p b / 4.0
(double) $4 = 200

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20160407/fd22a2db/attachment.html>


More information about the lldb-dev mailing list