[llvm-bugs] [Bug 42058] New: missing warning diagnosis of implicit conversion from 'double' to 'float'
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed May 29 05:26:33 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42058
Bug ID: 42058
Summary: missing warning diagnosis of implicit conversion from
'double' to 'float'
Product: clang
Version: 6.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: tangyixuan at mail.dlut.edu.cn
CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
richard-llvm at metafoo.co.uk
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190529/9fa463a3/attachment.html>
More information about the llvm-bugs
mailing list