<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 --- - -Wfloat-equal issued too much" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23717&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=07316fmOfenPLY8AZDF4PfE9sL9rhxRyJbjWXlRUhPU&s=i1xTeRoTaoqfDdgErFzWRQacC7GFrdwCOtrmdRt2rlY&e=">23717</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>-Wfloat-equal issued too much
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>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>javier_3@runbox.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>The code at SemaChecking.cpp, function Sema::CheckFloatComparison, issues the
warning warn_floatingpoint_eq (-Wfloat-equal) in case of using == or != with
floating point operands, but prevents the issuing of the warning in some
special cases, among which:
// Special case: check for comparisons against literals that can be exactly
// represented by APFloat.
So if the code reads if(x==0.0F) no warning is issued, but if the user simply
writes if(x==0) the warning is issued.
Given that both pieces of code get translated to exactly the same and the user
obviously knows what he is doing when writing if(x==0), my point is that in the
second case the warning should not be issued too.
I get dozens of annoying warning because of comparisons against zero, but I
don't want to turn off that warning because I think it's really meaningful in
the other cases, e.g. if(x==y).</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>