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(sym)->getRegion()); + case SymExpr::RegionValueKind: { + const MemRegion *MR = cast(sym)->getRegion(); + KnownLive = isLiveRegion(MR) && !reapedStore.getStoreManager() + .hasDirectBinding(reapedStore.getStore(), MR); break; + } case SymExpr::ConjuredKind: KnownLive = false; break;