[Bug c++/105278] -Wliteral-range vs -Wfloat-equal

2022-11-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105278

--- Comment #8 from Andrew Pinski  ---
So clang emits one or the other warning for the code but not both.

You can defect the warning in clang by doing:
```
extern void g( int);
void f(float a)
{
  double b = a;
  if (b == 0.1234)
g( 1);
}
```

LLVM actually opimizes away the comparison while GCC does not.

[Bug c++/105278] -Wliteral-range vs -Wfloat-equal

2022-11-17 Thread egallager at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105278

--- Comment #7 from Eric Gallager  ---
(In reply to Andrew Pinski from comment #6)
> I don't think clang implements -Wfloat-equal at all, at least they didn't at
> the last time I looked a few years back.

I just checked their diagnostics reference page and it says that they do:
https://clang.llvm.org/docs/DiagnosticsReference.html#wfloat-equal

[Bug c++/105278] -Wliteral-range vs -Wfloat-equal

2022-11-16 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105278

Andrew Pinski  changed:

   What|Removed |Added

Summary|no warning for precise  |-Wliteral-range vs
   |literals compared with  |-Wfloat-equal
   |floats  |

--- Comment #6 from Andrew Pinski  ---
I don't think clang implements -Wfloat-equal at all, at least they didn't at
the last time I looked a few years back.