Skip to content

Commit 052d503

Browse files
Use get_array in get_char_array_and_concretize
This makes sure the way we interpret arrays is consistent even in debugging functions.
1 parent 8ed138b commit 052d503

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

src/solvers/refinement/string_refinement.cpp

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -989,34 +989,35 @@ static exprt get_char_array_and_concretize(
989989
if(arr_model_opt)
990990
{
991991
stream << indent << indent << "- char_array: " << format(*arr_model_opt)
992+
<< '\n';
993+
stream << indent << indent << "- type : " << format(arr_model_opt->type())
992994
<< eom;
993995
const exprt simple = simplify_expr(*arr_model_opt, ns);
994996
stream << indent << indent << "- simplified_char_array: " << format(simple)
995997
<< eom;
996-
const exprt concretized_array =
997-
concretize_arrays_in_expression(simple, max_string_length, ns);
998-
stream << indent << indent
999-
<< "- concretized_char_array: " << format(concretized_array) << eom;
1000-
1001-
if(concretized_array.id() == ID_array)
1002-
{
1003-
stream << indent << indent << "- as_string: \""
1004-
<< string_of_array(to_array_expr(concretized_array)) << "\"\n";
1005-
}
1006-
else
998+
if(
999+
const auto concretized_array = get_array(
1000+
super_get, ns, max_string_length, stream, to_array_string_expr(simple)))
10071001
{
1008-
stream << indent << "- warning: not an array" << eom;
1009-
}
1002+
stream << indent << indent
1003+
<< "- concretized_char_array: " << format(*concretized_array)
1004+
<< eom;
10101005

1011-
stream << indent << indent << "- type: " << format(concretized_array.type())
1012-
<< eom;
1013-
return concretized_array;
1014-
}
1015-
else
1016-
{
1017-
stream << indent << indent << "- incomplete model" << eom;
1018-
return arr;
1006+
if(
1007+
const auto array_expr =
1008+
expr_try_dynamic_cast<array_exprt>(*concretized_array))
1009+
{
1010+
stream << indent << indent << "- as_string: \""
1011+
<< string_of_array(*array_expr) << "\"\n";
1012+
}
1013+
else
1014+
stream << indent << "- warning: not an array" << eom;
1015+
return *concretized_array;
1016+
}
1017+
return simple;
10191018
}
1019+
stream << indent << indent << "- incomplete model" << eom;
1020+
return arr;
10201021
}
10211022

10221023
/// Display part of the current model by mapping the variables created by the

0 commit comments

Comments
 (0)