Hi zaks.anna, jordan_rose, krememek,
Do not assume SymbolRegionValues live if their regions have direct bindings
http://llvm.org/bugs/show_bug.cgi?id=20563
http://reviews.llvm.org/D5104
Files:
include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
lib/StaticAnalyzer/Core/RegionStore.cpp
lib/StaticAnalyzer/Core/SymbolManager.cpp
Index: include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
===================================================================
--- include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
+++ include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
@@ -146,6 +146,8 @@
virtual bool includedInBindings(Store store,
const MemRegion *region) const = 0;
+
+ virtual bool hasDirectBinding(Store store, const MemRegion *R) const = 0;
/// If the StoreManager supports it, increment the reference count of
/// the specified Store object.
Index: lib/StaticAnalyzer/Core/RegionStore.cpp
===================================================================
--- lib/StaticAnalyzer/Core/RegionStore.cpp
+++ lib/StaticAnalyzer/Core/RegionStore.cpp
@@ -482,6 +482,10 @@
bool includedInBindings(Store store, const MemRegion *region) const override;
+ bool hasDirectBinding(Store store, const MemRegion *R) const override {
+ return getRegionBindings(store).getDirectBinding(R).hasValue();
+ }
+
/// \brief Return the value bound to specified location in a given state.
///
/// The high level logic for this method is this:
Index: lib/StaticAnalyzer/Core/SymbolManager.cpp
===================================================================
--- lib/StaticAnalyzer/Core/SymbolManager.cpp
+++ lib/StaticAnalyzer/Core/SymbolManager.cpp
@@ -446,9 +446,12 @@
bool KnownLive;
switch (sym->getKind()) {
- case SymExpr::RegionValueKind:
- KnownLive = isLiveRegion(cast<SymbolRegionValue>(sym)->getRegion());
+ case SymExpr::RegionValueKind: {
+ const MemRegion *MR = cast<SymbolRegionValue>(sym)->getRegion();
+ KnownLive = isLiveRegion(MR) && !reapedStore.getStoreManager()
+ .hasDirectBinding(reapedStore.getStore(), MR);
break;
+ }
case SymExpr::ConjuredKind:
KnownLive = false;
break;
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits