<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Integer division expression not correctly evaluated"
   href="https://llvm.org/bugs/show_bug.cgi?id=27257">27257</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Integer division expression not correctly evaluated
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.8
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>lldb-dev@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>tgfbeta@me.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16180" name="attach_16180" title="output with logging enabled.">attachment 16180</a> <a href="attachment.cgi?id=16180&action=edit" title="output with logging enabled.">[details]</a></span>
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</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>