Issue |
83765
|
Summary |
No warning reported for floating point comparison
|
Labels |
new issue
|
Assignees |
|
Reporter |
mushenoy
|
Clang doesnt report any warning for floating point comparision, while GCC reports a warning for the same program.
Sample program:
```
struct number { float no; };
int test (struct number *obj) {
if (! obj->no ) {
return 0;
}
return 1;
}
```
Compilation with Clang:
No warnings reported
```
# clang -Wfloat-equal -c prog.c
#
```
Compilation with GCC:
```
# gcc -Wfloat-equal -c prog.c
prog.c: In function test:
prog.c:4:13: warning: comparing floating-point with == or != is unsafe [-Wfloat-equal]
4 | if (! obj->no ) {
| ^
```
Compiler Versions:
```
clang version 16.0.6
gcc (GCC) 13.2.1
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs