Skip to content

Commit 9d1aa99

Browse files
Correct constraints added for char_set
The string constraint body should not contain the universal variable outside of string access. However this is allowed in the guard, which we use here. The meaning of the constraint is the same, but it is of a form accepted by the string solver.
1 parent e125e8a commit 9d1aa99

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/solvers/refinement/string_constraint_generator_transformation.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,10 @@ exprt string_constraint_generatort::add_axioms_for_char_set(
354354
axioms.push_back(equal_exprt(res.length(), str.length()));
355355
axioms.push_back(equal_exprt(res[position], character));
356356
const symbol_exprt q = fresh_univ_index("QA_char_set", position.type());
357-
or_exprt a3_body(equal_exprt(q, position), equal_exprt(res[q], str[q]));
358-
axioms.push_back(string_constraintt(q, res.length(), a3_body));
357+
equal_exprt a3_body(res[q], str[q]);
358+
notequal_exprt a3_guard(q, position);
359+
axioms.push_back(string_constraintt(
360+
q, from_integer(0, q.type()), res.length(), a3_guard, a3_body));
359361
return if_exprt(
360362
out_of_bounds, from_integer(1, f.type()), from_integer(0, f.type()));
361363
}

0 commit comments

Comments
 (0)