@@ -935,50 +935,21 @@ static optionalt<exprt> get_array(
935
935
}
936
936
std::size_t n = *n_opt;
937
937
938
- const array_typet ret_type (char_type, from_integer (n, index_type));
939
- array_exprt ret (ret_type);
940
-
941
- if (n>max_string_length)
938
+ if (n > MAX_CONCRETE_STRING_SIZE)
942
939
{
943
940
stream << " (sr::get_array) long string (size=" << n << " )" << eom;
944
- return {};
945
- }
946
-
947
- if (n==0 )
948
- return empty_ret;
949
-
950
- if (arr_val.id ()==" array-list" )
951
- {
952
- DATA_INVARIANT (
953
- arr_val.operands ().size ()%2 ==0 ,
954
- string_refinement_invariantt (" and index expression must be on a symbol, "
955
- " with, array_of, if, or array, and all "
956
- " cases besides array are handled above" ));
957
- std::map<std::size_t , exprt> initial_map;
958
- for (size_t i = 0 ; i < arr_val.operands ().size (); i += 2 )
959
- {
960
- exprt index = arr_val.operands ()[i];
961
- if (auto idx = numeric_cast<std::size_t >(index ))
962
- {
963
- if (*idx < n)
964
- initial_map[*idx] = arr_val.operands ()[i + 1 ];
965
- }
966
- }
967
-
968
- // Pad the concretized values to the left to assign the uninitialized
969
- // values of result.
970
- ret.operands ()=fill_in_map_as_vector (initial_map);
971
- return ret;
972
- }
973
- else if (arr_val.id ()==ID_array)
974
- {
975
- // copy the `n` first elements of `arr_val`
976
- for (size_t i=0 ; i<arr_val.operands ().size () && i<n; i++)
977
- ret.move_to_operands (arr_val.operands ()[i]);
978
- return ret;
979
- }
980
- else
981
- return {};
941
+ std::ostringstream msg;
942
+ msg << " consider reducing string-max-input-length so that no string "
943
+ << " exceeds " << MAX_CONCRETE_STRING_SIZE << " in length and make sure"
944
+ << " all functions returning strings are available in the classpath" ;
945
+ throw string_refinement_invariantt (msg.str ());
946
+ }
947
+
948
+ if (
949
+ const auto &array = interval_sparse_arrayt::of_expr (
950
+ arr_val, from_integer (CHARACTER_FOR_UNKNOWN, char_type)))
951
+ return array->concretize (n, index_type);
952
+ return {};
982
953
}
983
954
984
955
// / convert the content of a string to a more readable representation. This
0 commit comments