Skip to content

Commit 3ef9ec8

Browse files
Correct for_each_successor method
In a builtin_function if an argument is an if-expression then we should not consider that as a successor node, but look at the atomic parts of this expression.
1 parent aebadee commit 3ef9ec8

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/solvers/refinement/string_refinement_util.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,21 @@ void string_dependenciest::for_each_successor(
396396
const auto &builtin = builtin_function_nodes[node.index];
397397
for(const auto &s : builtin->string_arguments())
398398
{
399-
if(const auto node = node_at(s))
400-
f(nodet(*node));
399+
std::vector<std::reference_wrapper<const exprt>> stack({s});
400+
while(!stack.empty())
401+
{
402+
const auto current = stack.back();
403+
stack.pop_back();
404+
if(const auto if_expr = expr_try_dynamic_cast<if_exprt>(current.get()))
405+
{
406+
stack.emplace_back(if_expr->true_case());
407+
stack.emplace_back(if_expr->false_case());
408+
}
409+
else if(const auto node = node_at(to_array_string_expr(current)))
410+
f(nodet(*node));
411+
else
412+
UNREACHABLE;
413+
}
401414
}
402415
}
403416
else if(node.kind == nodet::STRING)

0 commit comments

Comments
 (0)