This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Suggested new warning.
- To: duz at rtsffm dot com
- Subject: Re: Suggested new warning.
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Thu, 30 Sep 1999 00:12:52 -0600
- cc: gcc-patches at gcc dot gnu dot org
- Reply-To: law at cygnus dot com
In message <199906151206.OAA14325@rtssun5.rtsffm.com>you write:
>
>
> Dear egcs/gcc maintainers,
>
> recently we had a bug to fix which boiled down to the mistake that two
> floating point numbers were compared using "==" or "!=". Both were
> only almost equal of course. Thinking about how to find similar places
> in our code body, I found it most easiest to enhance the compiler by a
> warning.
>
> The following patch to egcs-19990608 introduces a warning when
> floating point operands are compared using "==" or "!=".
>
> Testing this with our code the warning barfed at lots of places where
> comparision with 0.0 were made. It is unlikely that we'll want to
> change such places. Therefore a further improvement might be, not to
> warn when one of the operands is a constant.
>
> Although not perfect yet, I'd suggest incorporation of this little
> enhancement. It is turned off by default. So nobody will be surprised
> unpleasently.
>
> Best regards
>
> Dirk Zoller
>
> Here is the patch:
[ ... ]
Sorry it took so long to get back to this patch.
I think it's an excellent idea too. I updated the patch to apply to the
current sources, added some documentation to invoke.texi and installed it.
Thanks,
jeff