[cfe-dev] [analyzer] Introducing FloatingCompare checker

Anna Zaks via cfe-dev cfe-dev at lists.llvm.org
Wed Sep 2 22:39:01 PDT 2015

Hi Kirill,

The checkPreStmt callback should be used by checkers that require symbolic execution. Check out the video of our talk for introduction into how that works http://llvm.org/devmtg/2012-11/videos/Zaks-Rose-Checker24Hours.mp4. Looks like this checker is only performing a syntactic check, so using an AST visitor would be more appropriate http://clang-analyzer.llvm.org/checker_dev_manual.html#ast.

However, most importantly, similar functionality is already implemented in the compiler (see -Wfloat-equal)! Looks like it does not work when comparing against a constant. I am not sure what the reason for that is; was it a a source of false positives or just an oversight.

Since the warning is in place, we should remove this from the list of checkers to be implemented.

Thank you,

> On Sep 2, 2015, at 2:58 PM, Kirill Bobyrev via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> I've started implementing different.FloatingCompare checker from the list of potential checkers <http://clang-analyzer.llvm.org/potential_checkers.html>. I'd like to gather some feedback and do some improvements in order to push the code to the upstream in the near future.
> Vassil Vassilev mentioned it might be reasonable if the checker could detect that there is division which might yield precision loss and then detect a check against a 'constant' values.
> What do you think? What should be the checker's default behavior?
> The first version of checker is attached.
> --
> Kirill Bobyrev
> https://github.com/omtcyf0 <https://github.com/omtcyf0>
> <FloatingCompareChecker.patch>_______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150902/d255011f/attachment.html>

More information about the cfe-dev mailing list