[clang] [clang][dataflow] Fix crash on base-to-derived cast of unmodeled pointer value. (PR #179060)
Yitzhak Mandelbaum via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 4 10:12:31 PST 2026
================
@@ -328,9 +328,9 @@ class TransferVisitor : public ConstStmtVisitor<TransferVisitor> {
RecordStorageLocation *Loc = nullptr;
if (S->getType()->isPointerType()) {
auto *PV = Env.get<PointerValue>(*SubExpr);
- assert(PV != nullptr);
if (PV == nullptr)
- break;
+ PV = cast<PointerValue>(Env.createValue(S->getType()));
----------------
ymand wrote:
`createValue` can return nullptr. It's possible that for PointerValue type it always returns nonnull, but I think that's risky to depend on. So, you need to account for that case.
Moreover, this requires a comment explaining the new behavior.
https://github.com/llvm/llvm-project/pull/179060
More information about the cfe-commits
mailing list