Fix rand_mode() on nested object variables causes Z3 solver error (#7031) (#7034)

This commit is contained in:
Yilou Wang
2026-02-10 13:59:09 -05:00
committed by GitHub
parent 8791e6c5f2
commit 925543676e
3 changed files with 135 additions and 2 deletions
+3 -2
View File
@@ -890,8 +890,9 @@ class ConstraintExprVisitor final : public VNVisitor {
nodep->unlinkFrBack(&relinker);
AstNodeExpr* exprp;
if (randMode.usesMode) {
// Use string literal to avoid double formatting
exprp = new AstConst{nodep->fileline(), AstConst::String{}, smtName};
// Use AstSFormatF (not AstConst{String}) to prevent editFormat/V3Const
// from reformatting the SMT variable name into a hex literal
exprp = new AstSFormatF{nodep->fileline(), smtName, false, nullptr};
// Get const format, using membersel if available for correct width/value
AstNodeExpr* constFormatp