<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:david.majnemer@gmail.com" title="David Majnemer <david.majnemer@gmail.com>"> <span class="fn">David Majnemer</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed" title="RESOLVED INVALID - Division of signed ints incorrectly optimizes to right bitshift" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24090&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=xq7vOIhOEzivcbjdi7fSrdLqMYi2ikJ185Sh4uIyqS4&s=MarRP3wE0vJ82a4P2ZgVh-C5qdFqI6pU7Nrz_TFMcWA&e=">bug 24090</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>NEW
</td>
<td>RESOLVED
</td>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>david.majnemer@gmail.com
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>INVALID
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed" title="RESOLVED INVALID - Division of signed ints incorrectly optimizes to right bitshift" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24090-23c1&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=xq7vOIhOEzivcbjdi7fSrdLqMYi2ikJ185Sh4uIyqS4&s=KbddSBpZ0D0CAOGR2JUOKss14LAAEWKS8Dknxw9_aiU&e=">Comment # 1</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed" title="RESOLVED INVALID - Division of signed ints incorrectly optimizes to right bitshift" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24090&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=xq7vOIhOEzivcbjdi7fSrdLqMYi2ikJ185Sh4uIyqS4&s=MarRP3wE0vJ82a4P2ZgVh-C5qdFqI6pU7Nrz_TFMcWA&e=">bug 24090</a>
from <span class="vcard"><a class="email" href="mailto:david.majnemer@gmail.com" title="David Majnemer <david.majnemer@gmail.com>"> <span class="fn">David Majnemer</span></a>
</span></b>
<pre>Your code relies on undefined behavior. Because of this, LLVM's optimizations
cannot ensure your program will have the same result as an -O0 build.
angle is 315. angle / 45 is 7. ANG45 * 7 == 536870912 * 7 == -536870912.
Multiplying two positive signed integers cannot result in a negative number
without violating C or C++'s rules on undefined behavior: signed overflow is
undefined.
The operations you perform with 'an' assume that signed overflow does not
occur, because doing so is undefined, and thus the incongruent behavior between
-O0 and -O3.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>