Skip to content

Commit

Permalink
Correct add_constraints in string_dependencies
Browse files Browse the repository at this point in the history
When the result of a function is not tested we don't need to add full
constraints, but constraints about the length may still be necessary as
the length field of the string can be accessed directly.
  • Loading branch information
romainbrenguier committed Mar 25, 2018
1 parent 61b3910 commit 805f45f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/solvers/refinement/string_refinement_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,13 +442,15 @@ void string_dependenciest::add_constraints(
for_each_successor(n, f);
});

for(const auto &node : test_dependencies)
for(const auto &node : builtin_function_nodes)
{
if(node.kind == node.BUILTIN)
if(test_dependencies.count(nodet(node)))
{
const auto &builtin = builtin_function_nodes[node.index];
const exprt return_value = builtin.data->add_constraints(generator);
generator.add_lemma(equal_exprt(return_value, builtin.data->return_code));
}
else
generator.add_lemma(node.data->length_constraint());
}
}
3 changes: 3 additions & 0 deletions src/solvers/refinement/string_refinement_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ class string_dependenciest

void output_dot(std::ostream &stream) const;

/// For all builtin call on which a test (or an unsupported buitin)
/// result depends, add the corresponding constraints. For the other builtin
/// only add constraints on the length.
void add_constraints(string_constraint_generatort &generatort);

private:
Expand Down

0 comments on commit 805f45f

Please sign in to comment.