[clang] [llvm] [analyzer] Fix _BitInt support & casting behavior for Z3 symbolic execution (PR #210525)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 19 02:16:12 PDT 2026


================
@@ -750,10 +729,8 @@ void ExprEngine::VisitLogicalExpr(const BinaryOperator* B, ExplodedNode *Pred,
       // We evaluate "RHSVal != 0" expression which result in 0 if the value is
       // known to be false, 1 if the value is known to be true and a new symbol
       // when the assumption is unknown.
-      nonloc::ConcreteInt Zero(getBasicVals().getValue(0, B->getType()));
-      X = evalBinOp(N->getState(), BO_NE,
-                    svalBuilder.evalCast(RHSVal, B->getType(), RHS->getType()),
-                    Zero, B->getType());
+      X = evalBinOp(N->getState(), BO_NE, RHSVal,
+                    svalBuilder.makeZeroVal(RHS->getType()), B->getType());
----------------
steakhal wrote:

Right. It's very difficult to judge what that cast had to do there. If I had to guess, it's likely for promotion or standard conversion rules.
Now that we are here, why did you drop it?
Could you add this test to the normal solver as well? I'm curious to see how would it behave after the patch. on trunk, it says `TRUE` - https://godbolt.org/z/Ex3eMo7GE.

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


More information about the cfe-commits mailing list