Skip to content

Commit 038b476

Browse files
Allow index for argument of associate array to pointer
1 parent 73d51fc commit 038b476

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/solvers/refinement/string_constraint_generator_main.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,13 @@ exprt string_constraint_generatort::associate_array_to_pointer(
252252
const function_application_exprt &f)
253253
{
254254
PRECONDITION(f.arguments().size() == 2);
255-
array_string_exprt array_expr = to_array_string_expr(f.arguments()[0]);
255+
256+
/// \todo: we allow expression of the form of `arr[0]` instead of `arr` as
257+
/// the array argument but this could go away.
258+
array_string_exprt array_expr = to_array_string_expr(
259+
f.arguments()[0].id() == ID_index ? to_index_expr(f.arguments()[0]).array()
260+
: f.arguments()[0]);
261+
256262
const exprt &pointer_expr = f.arguments()[1];
257263

258264
const auto &length = array_expr.length();

0 commit comments

Comments
 (0)