[clang] [analyzer] Trust base to derived casts for dynamic types (PR #69057)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 13 07:37:24 PST 2023


steakhal wrote:

Thanks for the replies.
I'll come back to this PR once I have some time; maybe during the holidays.
Both assertions directly relate to this PR for sure.

> I looked into Tom's bug report and I hit the following assertion in a debug build:
> 
> ```
> clang: /srv/repos/llvm-project/clang/lib/StaticAnalyzer/Core/DynamicType.cpp:134: clang::ento::ProgramStateRef clang::ento::setDynamicTypeAndCastInfo(clang::ento::ProgramStateRef, const clang::ento::MemRegion*, clang::QualType, clang::QualType, bool): Assertion `(CastToTy->isAnyPointerType() || CastToTy->isReferenceType()) && "DynamicTypeInfo should always be a pointer."' failed.
> ```
> [...]
> What I don't understand is why these are not reference types. @steakhal do you know more here?
Its because prior we `unbox` them I believe, which here sort of means that we drop refs and pointers I think.




https://github.com/llvm/llvm-project/pull/69057


More information about the cfe-commits mailing list