diff --git a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp --- a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp +++ b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp @@ -800,6 +800,12 @@ return UnknownVal(); QualType Ty = cast(SR)->getDesugaredValueType(Ctx); + if (Ty->isPointerType()) { + QualType PointeeTy = Ty->getPointeeType(); + if(!PointeeTy->isIncompleteType() && PointeeTy->isObjectType()){ + Ty = PointeeTy; + } + } const DefinedOrUnknownSVal Size = getElementExtent(Ty, SVB); // We currently don't model flexible array members (FAMs), which are: