<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - The shift didn't carry out the value in bit-field structure"
href="https://bugs.llvm.org/show_bug.cgi?id=32708">32708</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>The shift didn't carry out the value in bit-field structure
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</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>enhancement
</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>shiva0217@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>According to C99 6.7.2.1
9 A bit-field is interpreted as a signed or unsigned integer type consisting of
the specified number of bits.
So the bit exceed the number of bits after shift should carry out.
In the following case,
x.b:40 initial as 0x0100 should carry out to 0 after (x.b<<32)
struct foo
{
unsigned long long b:40;
} x;
extern void abort (void);
void test1(unsigned long long res)
{
/* The shift is carried out in 40 bit precision. */
if (x.b<<32 != res)
abort ();
}
int main()
{
x.b = 0x0100;
test1(0);
return 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>