[cfe-commits] r44058 - in /cfe/trunk: Sema/SemaExpr.cpp test/Sema/floating-point-compare.c

Ted Kremenek kremenek at apple.com
Tue Nov 13 15:35:53 PST 2007


On Nov 13, 2007, at 2:45 PM, Neil Booth wrote:

> Chris Lattner wrote:-
>
>>
>> On Nov 13, 2007, at 11:17 AM, Ted Kremenek wrote:
>>
>>> Author: kremenek
>>> Date: Tue Nov 13 13:17:00 2007
>>> New Revision: 44058
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=44058&view=rev
>>> Log:
>>> Modified -Wfloat-equal logic to suppress warnings where floating
>>> point values
>>> are compared against builtins such as __builtin_inf.
>
> More generally, should it be suppressed for comparisons against
> any FP constant that is exact as written?
>
> Neil.

I'm not certain.  Also, I wonder if the following two cases should be  
treated separately:

   x == 0.0

and

  x == 3.14159  (or any non-zero constant)

The first case still isn't really kosher either, but suppressing  
warnings for explicit tests against 0.0 probably will suppress more  
false positives than the number of false negatives it will cause.  I  
think the second case is far more likely to be an error.



More information about the cfe-commits mailing list