@@ -285,23 +285,27 @@ void ExprEngine::VisitCast(const CastExpr *CastE, const Expr *Ex,
285285 ExplodedNodeSet dstPreStmt;
286286 getCheckerManager ().runCheckersForPreStmt (dstPreStmt, Pred, CastE, *this );
287287
288- if (CastE->getCastKind () == CK_LValueToRValue ||
289- CastE->getCastKind () == CK_LValueToRValueBitCast) {
288+ if (CastE->getCastKind () == CK_LValueToRValue) {
289+ for (ExplodedNode *subExprNode : dstPreStmt) {
290+ ProgramStateRef state = subExprNode->getState ();
291+ const LocationContext *LCtx = subExprNode->getLocationContext ();
292+ evalLoad (Dst, CastE, CastE, subExprNode, state, state->getSVal (Ex, LCtx));
293+ }
294+ return ;
295+ }
296+ if (CastE->getCastKind () == CK_LValueToRValueBitCast) {
297+ // Handle `__builtin_bit_cast`:
290298 ExplodedNodeSet dstEvalLoad;
291299
300+ // Simulate the lvalue-to-rvalue conversion on `Ex`:
292301 for (ExplodedNode *subExprNode : dstPreStmt) {
293302 ProgramStateRef state = subExprNode->getState ();
294303 const LocationContext *LCtx = subExprNode->getLocationContext ();
295- evalLoad (dstEvalLoad, CastE, CastE, subExprNode, state,
296- state->getSVal (Ex, LCtx));
297- }
298- if (CastE->getCastKind () == CK_LValueToRValue) {
299- Dst.insert (dstEvalLoad);
300- return ;
304+ evalLocation (dstEvalLoad, CastE, Ex, subExprNode, state,
305+ state->getSVal (Ex, LCtx), true );
301306 }
302- assert (CastE->getCastKind () == CK_LValueToRValueBitCast &&
303- " unexpected cast kind" );
304- // Need to simulate the actual cast operation:
307+ // Simulate the operation that actually casts the original value to a new
308+ // value of the destination type :
305309 StmtNodeBuilder Bldr (dstEvalLoad, Dst, *currBldrCtx);
306310
307311 for (ExplodedNode *Node : dstEvalLoad) {
0 commit comments