<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 --- - float2int miscompile"
href="https://llvm.org/bugs/show_bug.cgi?id=23038">23038</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>float2int miscompile
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nlewycky@google.com
</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>Created <span class=""><a href="attachment.cgi?id=14106" name="attach_14106" title="C testcase">attachment 14106</a> <a href="attachment.cgi?id=14106&action=edit" title="C testcase">[details]</a></span>
C testcase
opt -float2int transforms this:
define i32 @test(i8 %call) {
%conv1 = sitofp i8 %call to float
%mul = fmul float %conv1, -3.000000e+00
%conv2 = fptosi float %mul to i8
%conv3 = sext i8 %conv2 to i32
ret i32 %conv3
}
into this:
define i32 @test(i8 %call) {
%1 = sext i8 %call to i32
%mul1 = mul i32 %1, 0 ;; XXX nope
%2 = trunc i32 %mul1 to i8
%conv3 = sext i8 %2 to i32
ret i32 %conv3
}
See attached .cc testcase that fails with "clang -O2 -fno-inline" (by printing
"0 -27 0" when it should print "-27 -27 1").</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>