]> granicus.if.org Git - clang/commit
[analyzer] Base regions may be invalid when layered on symbolic regions.
authorJordan Rose <jordan_rose@apple.com>
Mon, 25 Feb 2013 18:36:15 +0000 (18:36 +0000)
committerJordan Rose <jordan_rose@apple.com>
Mon, 25 Feb 2013 18:36:15 +0000 (18:36 +0000)
commit6dc5c33fd4334ccf4a661c331f86e23829e51d55
tree39407051dbf5e5504c55e273165483df45790dcc
parentdf779d356a298732bedd6f6fbe01b8f4b1a6948e
[analyzer] Base regions may be invalid when layered on symbolic regions.

While RegionStore checks to make sure casts on TypedValueRegions are valid,
it does not do the same for SymbolicRegions, which do not have perfect type
info anyway. Additionally, MemRegion::getAsOffset does not take a
ProgramState, so it can't use dynamic type info to determine a better type
for the regions. (This could also be dangerous if the type of a super-region
changes!)

Account for this by checking that a base object region is valid on top of a
symbolic region, and falling back to "symbolic offset" mode if not.

Fixes PR15345.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176034 91177308-0d34-0410-b5e6-96231b3b80d8
lib/StaticAnalyzer/Core/MemRegion.cpp
test/Analysis/reinterpret-cast.cpp