@@ -105,7 +105,8 @@ static optionalt<exprt> get_array(
105
105
const std::function<exprt(const exprt &)> &super_get,
106
106
const namespacet &ns,
107
107
messaget::mstreamt &stream,
108
- const array_string_exprt &arr);
108
+ const array_string_exprt &arr,
109
+ const array_poolt &array_pool);
109
110
110
111
static exprt substitute_array_access (
111
112
const index_exprt &index_expr,
@@ -955,12 +956,14 @@ void string_refinementt::add_lemma(
955
956
// / \param ns: namespace
956
957
// / \param stream: output stream for warning messages
957
958
// / \param arr: expression of type array representing a string
959
+ // / \param array_pool: pool of arrays representing strings
958
960
// / \return an optional array expression or array_of_exprt
959
961
static optionalt<exprt> get_array (
960
962
const std::function<exprt(const exprt &)> &super_get,
961
963
const namespacet &ns,
962
964
messaget::mstreamt &stream,
963
- const array_string_exprt &arr)
965
+ const array_string_exprt &arr,
966
+ const array_poolt &array_pool)
964
967
{
965
968
const exprt &size = arr.length ();
966
969
exprt arr_val = simplify_expr (adjust_if_recursive (super_get (arr), ns), ns);
@@ -1028,17 +1031,19 @@ static std::string string_of_array(const array_exprt &arr)
1028
1031
// / \param ns: namespace
1029
1032
// / \param stream: output stream
1030
1033
// / \param arr: array expression
1034
+ // / \param array_pool: pool of arrays representing strings
1031
1035
// / \return expression corresponding to `arr` in the model
1032
1036
static exprt get_char_array_and_concretize (
1033
1037
const std::function<exprt(const exprt &)> &super_get,
1034
1038
const namespacet &ns,
1035
1039
messaget::mstreamt &stream,
1036
- const array_string_exprt &arr)
1040
+ const array_string_exprt &arr,
1041
+ array_poolt &array_pool)
1037
1042
{
1038
1043
stream << " - " << format (arr) << " :\n " ;
1039
1044
stream << std::string (4 , ' ' ) << " - type: " << format (arr.type ())
1040
1045
<< messaget::eom;
1041
- const auto arr_model_opt = get_array (super_get, ns, stream, arr);
1046
+ const auto arr_model_opt = get_array (super_get, ns, stream, arr, array_pool );
1042
1047
if (arr_model_opt)
1043
1048
{
1044
1049
stream << std::string (4 , ' ' ) << " - char_array: " << format (*arr_model_opt)
@@ -1049,8 +1054,8 @@ static exprt get_char_array_and_concretize(
1049
1054
stream << std::string (4 , ' ' )
1050
1055
<< " - simplified_char_array: " << format (simple) << messaget::eom;
1051
1056
if (
1052
- const auto concretized_array =
1053
- get_array ( super_get, ns, stream, to_array_string_expr (simple)))
1057
+ const auto concretized_array = get_array (
1058
+ super_get, ns, stream, to_array_string_expr (simple), array_pool ))
1054
1059
{
1055
1060
stream << std::string (4 , ' ' )
1056
1061
<< " - concretized_char_array: " << format (*concretized_array)
@@ -1081,14 +1086,15 @@ void debug_model(
1081
1086
messaget::mstreamt &stream,
1082
1087
const namespacet &ns,
1083
1088
const std::function<exprt(const exprt &)> &super_get,
1084
- const std::vector<symbol_exprt> &symbols)
1089
+ const std::vector<symbol_exprt> &symbols,
1090
+ array_poolt &array_pool)
1085
1091
{
1086
1092
stream << " debug_model:" << ' \n ' ;
1087
1093
for (const auto &pointer_array : generator.array_pool .get_arrays_of_pointers ())
1088
1094
{
1089
1095
const auto arr = pointer_array.second ;
1090
1096
const exprt model =
1091
- get_char_array_and_concretize (super_get, ns, stream, arr);
1097
+ get_char_array_and_concretize (super_get, ns, stream, arr, array_pool );
1092
1098
1093
1099
stream << " - " << format (arr) << " :\n "
1094
1100
<< " - pointer: " << format (pointer_array.first ) << " \n "
@@ -1333,7 +1339,12 @@ static std::pair<bool, std::vector<exprt>> check_axioms(
1333
1339
1334
1340
#ifdef DEBUG
1335
1341
debug_model (
1336
- generator, stream, ns, get, generator.fresh_symbol .created_symbols );
1342
+ generator,
1343
+ stream,
1344
+ ns,
1345
+ get,
1346
+ generator.fresh_symbol .created_symbols ,
1347
+ generator.array_pool );
1337
1348
#endif
1338
1349
1339
1350
// Maps from indexes of violated universal axiom to a witness of violation
@@ -1831,7 +1842,9 @@ exprt string_refinementt::get(const exprt &expr) const
1831
1842
dependencies.eval (arr, [&](const exprt &expr) { return get (expr); }))
1832
1843
return *from_dependencies;
1833
1844
1834
- if (const auto arr_model_opt = get_array (super_get, ns, log .debug (), arr))
1845
+ if (
1846
+ const auto arr_model_opt =
1847
+ get_array (super_get, ns, log .debug (), arr, generator.array_pool ))
1835
1848
return *arr_model_opt;
1836
1849
1837
1850
if (
0 commit comments