<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 --- - emit warnings if bit operations (especially << and >>) performed on signed values"
href="https://llvm.org/bugs/show_bug.cgi?id=25881">25881</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>emit warnings if bit operations (especially << and >>) performed on signed values
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>socketpair@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>for '<<'
6.5.7/4 [...] If E1 has a signed type and nonnegative value, and E1×2E2 is
representable in the result type, then that is the resulting value; otherwise,
the behavior is undefined.
and for '>>'
6.5.7/5 [...] If E1 has a signed type and a negative value, the resulting value
is implementation- defined.
I think, other operations, like &, |, ^, ~ should issue warning when applied to
signed variables.
So, next program do not emit warning now:
int main() {
volatile int qwe = -10;
return qwe >> 3;
}
$ clang-3.7 qwe.c -Wall -Wextra
Also, static analyzis should also find that.</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>