<html>
<head>
<base href="http://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 --- - Invalid optimization for 8-byte integers with -O2"
href="http://llvm.org/bugs/show_bug.cgi?id=15584">15584</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Invalid optimization for 8-byte integers with -O2
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>3.2
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>release blocker
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>rybalkin@ggasoftware.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=10237" name="attach_10237" title="example source code">attachment 10237</a> <a href="attachment.cgi?id=10237&action=edit" title="example source code">[details]</a></span>
example source code
Provided source code gives incorrect result with -O2 optimization flags.
It reports that number of one bits in 0xFFFFFFFFFFFFFFFFULL 64 without
optimizations and less then 64 (random results like 58, 59, 60) with -O2 flags.
This code computes number of common 'one' bits in two binary arrays:
1. bitGetOnesCountByte is a simple table lookup function to get number of one
bits in a single byte.
2. bitGetOnesCount method counts number of one bits in a binary array
3. bitCommonOnes method counts common one bits in two qword-arrays. It perform
bit and operation and count number of one bits in the result via
bitGetOnesCount method.
Compile inlines bitGetOnesCount in bitCommonOnes method and unroll loop because
number of bytes in qword is 8. Probably the bug is due to this step.
Clang version:
Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.2.0
Thread model: posix
Reproduced on Mac OS X 10.7 and Mac OS X 10.8.
Not reproduced on Debian with clang 3.0.</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>