File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -8933,11 +8933,19 @@ namespace smt {
8933
8933
if (Sval_expr_exists) {
8934
8934
zstring Sval;
8935
8935
u.str.is_string(Sval_expr, Sval);
8936
- TRACE("str", tout << "string theory assigns \"" << mk_pp(a, m) << " = " << Sval << "\n";);
8936
+ TRACE("str", tout << "string theory assigns " << mk_pp(a, m) << " = \"" << Sval << "\ "\n";);
8937
8937
// empty string --> integer value < 0
8938
8938
if (Sval.empty()) {
8939
8939
// ignore this. we should already assert the axiom for what happens when the string is ""
8940
8940
} else {
8941
+ // check for leading zeroes. if the first character is '0', the entire string must be "0"
8942
+ char firstChar = (int)Sval[0];
8943
+ if (firstChar == '0' && !(Sval == zstring("0"))) {
8944
+ TRACE("str", tout << "str.to-int argument " << Sval << " contains leading zeroes" << std::endl;);
8945
+ expr_ref axiom(m.mk_not(ctx.mk_eq_atom(a, mk_string(Sval))), m);
8946
+ assert_axiom(axiom);
8947
+ return true;
8948
+ }
8941
8949
// nonempty string --> convert to correct integer value, or disallow it
8942
8950
rational convertedRepresentation(0);
8943
8951
rational ten(10);
You can’t perform that action at this time.
0 commit comments