<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 - Illegitimate warning for -Wfloat-conversion"
href="https://bugs.llvm.org/show_bug.cgi?id=40020">40020</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Illegitimate warning for -Wfloat-conversion
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>7.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</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>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>LTCMELO@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>When compiling the C snippet below with -Wconversion, clangs throws the
warning -Wfloat-conversion for (i) expression `x = y', and (ii) for expression
`0 || y'.
int f()
{
int x;
double y;
x = y;
0 || y;
return 0;
}
My interpretation is that the warning for (ii) is not legitimate and should be
removed. As opposed to 6.3.1.4[floating point conversion], where truncation is
defined upon a conversion (e.g., as in an assignment), section 6.5.14 only
relates to the notion of comparison. In particular, it is relevant whether an
operand compare to 0 (the same of a integral of floating point), given the
logical OR only requires that its operands are of scalar type.
GCC 7.3 only produces the warning for case (i), which is according to my
expectation, as described above.</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>