]> granicus.if.org Git - clang/commit
[analyzer] Evaluate integral casts as cast symbols if truncations are detected.
authorPierre Gousseau <pierregousseau14@gmail.com>
Tue, 12 Jan 2016 10:07:56 +0000 (10:07 +0000)
committerPierre Gousseau <pierregousseau14@gmail.com>
Tue, 12 Jan 2016 10:07:56 +0000 (10:07 +0000)
commit8c0250d7e9aa7dc86f27b0d2820043d6932ea0b1
tree38f978deeb1baff28a5e0caa2fefb0c190e59a25
parent81bc39246afd0604c315ffa2dc07a6a6c9ce0848
[analyzer] Evaluate integral casts as cast symbols if truncations are detected.

The current workaround for truncations not being modelled is that the evaluation of integer to integer casts are simply bypassed and so the original symbol is used as the new casted symbol (cf SimpleSValBuilder::evalCastFromNonLoc).
This lead to the issue described in PR25078, as the RangeConstraintManager associates ranges with symbols.

The new evalIntegralCast method added by this patch wont bypass the cast if it finds the range of the symbol to be greater than the maximum value of the target type.

The fix to RangeSet::pin mentioned in the initial review will be committed separately.

Differential Revision: http://reviews.llvm.org/D12901

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257464 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
lib/StaticAnalyzer/Core/ExprEngineC.cpp
lib/StaticAnalyzer/Core/SValBuilder.cpp
test/Analysis/range_casts.c [new file with mode: 0644]