diff --git a/clang/lib/Analysis/RegionStore.cpp b/clang/lib/Analysis/RegionStore.cpp index ec5acf57f4ea..b09c49ec0935 100644 --- a/clang/lib/Analysis/RegionStore.cpp +++ b/clang/lib/Analysis/RegionStore.cpp @@ -186,6 +186,14 @@ SVal RegionStoreManager::getLValueElement(const GRState* St, loc::MemRegionVal& BaseL = cast(Base); + // Pointer of any type can be cast and used as array base. We do not support + // that case yet. + if (!isa(BaseL.getRegion())) { + // Record what we have seen in real code. + assert(isa(BaseL.getRegion())); + return UnknownVal(); + } + // We expect BaseR is an ElementRegion, not a base VarRegion. const ElementRegion* ElemR = cast(BaseL.getRegion());