[clang] [analyzer] Model concrete floating-point values (PR #214098)
Balázs Benics via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 21 10:01:27 PDT 2026
================
@@ -288,8 +288,11 @@ void ExprEngine::VisitCast(const CastExpr *CastE, const Expr *Ex,
if (const MemRegion *MR = State->getSVal(Ex, SF).getAsRegion()) {
SVal OrigV = State->getSVal(MR);
- CastedV = svalBuilder.evalCast(svalBuilder.simplifySVal(State, OrigV),
- CastE->getType(), Ex->getType());
+ // evalCast converts the value, but we are doing a bitcast here, which
+ // is unmodeled for floats.
+ if (!OrigV.getAs<nonloc::ConcreteFloat>())
+ CastedV = svalBuilder.evalCast(svalBuilder.simplifySVal(State, OrigV),
+ CastE->getType(), Ex->getType());
----------------
steakhal wrote:
If `evalCast` does not model floats, then it should return `Unknown` - doesn't it? Which is the same as leaving `CastedV` as it was initialized (`Unknown`). So why do we have this guard here?
https://github.com/llvm/llvm-project/pull/214098
More information about the cfe-commits
mailing list