[clang] [clang][dataflow] Fix a new crash on assigning values of unmodeled types. (PR #179788)
Artem Dergachev via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 4 13:51:28 PST 2026
================
@@ -169,8 +169,16 @@ class TransferVisitor : public ConstStmtVisitor<TransferVisitor> {
break;
auto *RHSVal = Env.getValue(*RHS);
- if (RHSVal == nullptr)
+ if (RHSVal == nullptr) {
RHSVal = Env.createValue(LHS->getType());
+ if (RHSVal == nullptr) {
+ // At least make sure the old value is gone. It's unlikely to be there
+ // in the first place given that we don't even know how to create
+ // a basic unknown value of that type.
+ Env.clearValue(*LHSLoc);
----------------
haoNoQ wrote:
This is a purely imaginary situation. I have no reproducer for the situation where the value was actually already there. I could, like, `assert(!Env.getValue(*LHSLoc))` but that feels counterproductive. It's more productive to encourage people make values even if they can't do that in every case. (I'm also worried about future side effects in such an assertion.)
https://github.com/llvm/llvm-project/pull/179788
More information about the cfe-commits
mailing list