<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 - missing warning diagnosis of implicit conversion from 'double' to 'float'"
href="https://bugs.llvm.org/show_bug.cgi?id=42058">42058</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>missing warning diagnosis of implicit conversion from 'double' to 'float'
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>6.0
</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>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>tangyixuan@mail.dlut.edu.cn
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>For the following example, clang 6.0 misses the warning diagnosis of implicit
conversion from 'double' to 'float'.
$ cat s.c
int main(){
double w[2]={1.0,2.0},z[2]={2.0,4.0};
float b[2];
for(int j=1;j<2;j++){
b[j]+=z[j]/w[j];
}
return 0;
}
$ clang --version
clang version 6.0.0 (tags/RELEASE_600/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$ clang -Wconversion s.c
No warning generated.
Under the same workstation:
$ clang-7.0 -Wconversion s.c
s.c:5:13: warning: implicit conversion when assigning computation result loses
floating-point precision: 'double' to 'float' [-Wconversion]
b[j]+=z[j]/w[j];
~~~~~^~~~~
1 warning generated.
$ clang-8.0 -Wimplicit-float-conversion s.c
s.c:5:13: warning: implicit conversion when assigning computation result loses
floating-point precision: 'double' to 'float' [-Wimplicit-float-conversion]
b[j]+=z[j]/w[j];
~~~~~^~~~~
1 warning generated.</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>