<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 --- - false positive, -Wsign-compare, signed value obviously can't be negative" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24035&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=U-vCJrYSPkOWEYBu5OkAc0L4T0bjFSrU9hp0hsY8zrA&s=Cu_Al8FEGkmjbOcYNZgOcMLEUYG91nVNGZOZs9QvRCI&e=">24035</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>false positive, -Wsign-compare, signed value obviously can't be negative
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</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>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>daniel.marjamaki@evidente.se
</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>Code:
unsigned int dostuff();
void f(int x) {
if (x >= 0 && x < dostuff()) {}
}
Output:
signcompare.c:3:19: warning: comparison of integers of different signs: 'int'
and 'unsigned int' [-Wsign-compare]
if (x >= 0 && x < dostuff()) {}
~ ^ ~~~~~~~~~
it is obvious there can't be a bug here so there should not be a warning.
This kind of false positive is indirectly a security problem. People routinely
hide these false positives using casts or changed variable types etc. and that
cause bugs and hides other real warnings.</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>