OSDN Git Service

[analyzer] Introduce reasoning about symbolic remainder operator
authorValeriy Savchenko <vsavchenko@nitrogen.local>
Thu, 14 May 2020 14:07:54 +0000 (17:07 +0300)
committerValeriy Savchenko <vsavchenko@apple.com>
Thu, 28 May 2020 15:56:38 +0000 (18:56 +0300)
commit73c120a9895a7e12e3c29a755d64096c8bd0220f
tree8d53fc7bfa3f62fd3ab213cb882389b065af5df7
parent2a09daff0f902e70a08f2b30f3461fb8848f5ab1
[analyzer] Introduce reasoning about symbolic remainder operator

Summary:
New logic tries to narrow possible result values of the remainder operation
based on its operands and their ranges.  It also tries to be conservative
with negative operands because according to the standard the sign of
the result is implementation-defined.

rdar://problem/44978988

Differential Revision: https://reviews.llvm.org/D80117
clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
clang/test/Analysis/PR35418.cpp [new file with mode: 0644]
clang/test/Analysis/constant-folding.c
clang/test/Analysis/hangs.c
clang/test/Analysis/uninit-bug-first-iteration-init.c [new file with mode: 0644]