http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56887



Tobias Burnus <burnus at gcc dot gnu.org> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

                 CC|                            |burnus at gcc dot gnu.org



--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-04-09 
13:06:15 UTC ---

(In reply to comment #0)

> tests for equality between reals is flagged with a warning.



The support for the warning follows ISO/IEC TR 24772, which recommends users to

"Avoid creating a logical value from a test for equality or inequality

between two floating-point expressions." - And compiler vendors to provide such

a warning.



The problem with many constructs is that one cannot reliably detect whether

they are okay or a bug in the code. Thus, warnings are issued for those; there

are always false positives and missed bugs with warning diagnostic. Those

checks, where the false-positive rate is low and the likelihood for bugs is

high, are enabled by default; others only with -Wall or -Wextra or only with

-W<name-of-the-warning>.



In your case, using integer-valued floating-point numbers is probably fine. As

Thomas wrote, you can use -Wno-compare-reals to disable the warning. See GCC

4.8 release notes or gfortran's man page (or user manual) under -Wextra.

Reply via email to