<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 --- - Different result (integer wrap) by optimization setting" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23705&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=I6zAS92CZdbW-5NnkrQZvuTCtw2Q3OyPkwNnWEAhx3Y&s=cB6b57VsNlgg1-pP1I2vCqAFz53PVQhq111YYTYcUAM&e=">23705</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Different result (integer wrap) by optimization setting
</td>
</tr>
<tr>
<th>Product</th>
<td>tools
</td>
</tr>
<tr>
<th>Version</th>
<td>3.5
</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>llvm-gcc
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>HHG01200@nifty.ne.jp
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>On Mac OS X 10.10.3, Apple LLVM 6.0, with no optimization (-O0) or -O1, print
"A" (expected result).
However, with optimization (-Os), print "B" (not expected result).
file 1
-------------------
#include <stdio.h>
extern int GetA();
extern int GetB();
extern int GetC();
int main()
{
int a = GetA();
int c = GetC();
int d = GetB() - c;
if ((a - c) < (d))
{
puts("A");
}
else
{
puts("B");
}
return 0;
}
-------------------
file 2
-------------------
#include <limits.h>
int GetA()
{
return INT_MAX;
}
int GetB()
{
return INT_MIN;
}
int GetC()
{
return INT_MAX / 2;
}
-------------------</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>