[PATCH] D52730: [analyzer] ConversionChecker: handle floating point

Umann Kristóf via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 2 03:22:12 PDT 2018


Szelethus added inline comments.


================
Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:175
+
+  if (RepresentsUntilExp >= sizeof(unsigned long long)*8) {
     return false;
----------------
NoQ wrote:
> Szelethus wrote:
> > Szelethus wrote:
> > > How about `AC.getSizeType(AC.UnsignedLongLongTy))`?
> > I'm actually not too sure about this. @whisperity?
> Yeah, i suspect it's a host machine check (to prevent our own overflow on line 189) rather than a target machine check.
Oh right, thanks for clarifying that.
I looked it up, and the number of bits in a `char` can be acquired from `CHAR_BITS`, maybe use that instead of hard coding 8? https://en.cppreference.com/w/c/types/limits


Repository:
  rC Clang

https://reviews.llvm.org/D52730





More information about the cfe-commits mailing list