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

DonĂ¡t Nagy via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 1 09:54:28 PDT 2018


donat.nagy created this revision.
donat.nagy added reviewers: NoQ, george.karpenkov, rnkovacs, baloghadamsoftware, mikhail.ramalho.
Herald added subscribers: cfe-commits, Szelethus.

Extend the alpha.core.Conversion checker to handle implicit converions
where a too large integer value is converted to a floating point type. Each
floating point type has a range where it can exactly represent all integers; we
emit a warning when the integer value is above this range. Although it is
possible to exactly represent some integers which are outside of this range
(those that are divisible by a large enough power of 2); we still report cast
involving those, because their usage may lead to bugs. (For example, if 1<<24
is stored in a float variable x, then x==x+1 holds.)


Repository:
  rC Clang

https://reviews.llvm.org/D52730

Files:
  lib/StaticAnalyzer/Checkers/ConversionChecker.cpp
  test/Analysis/conversion.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52730.167756.patch
Type: text/x-patch
Size: 4073 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181001/1084c870/attachment.bin>


More information about the cfe-commits mailing list