<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 --- - Bitfield overflow on big-endian architectures"
href="http://llvm.org/bugs/show_bug.cgi?id=16691">16691</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Bitfield overflow on big-endian architectures
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.3
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</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>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>hausen@gmx.at
</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=10919" name="attach_10919" title="Test case pr55750 from gcc.c-torture/execute">attachment 10919</a> <a href="attachment.cgi?id=10919&action=edit" title="Test case pr55750 from gcc.c-torture/execute">[details]</a></span>
Test case pr55750 from gcc.c-torture/execute
For big-endian architectures (Mips, Sparc, ...), clang -O1 produces the
following code for function foo() in the attached test case (pr55750.c from
gcc.c-torture/execute):
define void @foo(i32 %i) #0 {
entry:
%0 = getelementptr inbounds [2 x %struct.S]* @arr, i32 0, i32 %i, i32 0
%bf.load = load i8* %0, align 4
%bf.ashr2 = and i8 %bf.load, 127
%addconv = add nsw i8 %bf.ashr2, 1
%bf.clear = and i8 %bf.load, -128
%bf.set = or i8 %addconv, %bf.clear
store i8 %bf.set, i8* %0, align 4
ret void
}
If the addition to field arr[i].n (%addconv) overflows 7 bits, field arr[i].m
is set to one instead of being left unchanged. The code for little-endian
architectures is okay, because field n occupies the upper 7 bits and overflows
can be ignored.</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>