@@ -169,11 +169,11 @@ void recursive_initializationt::initialize(
169169 goto_model.symbol_table .lookup_ref (fun_name);
170170 const auto proper_init_case = code_function_callt{
171171 fun_symbol.symbol_expr (), {depth, address_of_exprt{lhs}}};
172-
172+ const auto should_make_equal =
173+ get_fresh_local_typed_symexpr (" should_make_equal" , bool_typet{});
174+ body.add (code_declt{should_make_equal});
173175 body.add (code_ifthenelset{
174- side_effect_expr_nondett{bool_typet{}, source_locationt{}},
175- set_equal_case,
176- proper_init_case});
176+ should_make_equal, set_equal_case, proper_init_case});
177177 }
178178 else
179179 {
@@ -265,9 +265,7 @@ code_blockt recursive_initializationt::build_constructor_body(
265265 }
266266 if (lhs_name.has_value ())
267267 {
268- if (should_be_treated_as_cstring (*lhs_name) && type == char_type ())
269- return build_array_string_constructor (result_symbol);
270- else if (should_be_treated_as_array (*lhs_name))
268+ if (should_be_treated_as_array (*lhs_name))
271269 {
272270 CHECK_RETURN (size_symbol.has_value ());
273271 return build_dynamic_array_constructor (
@@ -693,9 +691,12 @@ code_blockt recursive_initializationt::build_pointer_constructor(
693691 code_blockt null_and_return{{assign_null, code_returnt{}}};
694692 body.add (code_ifthenelset{conjunction (should_not_recurse), null_and_return});
695693
694+ const auto should_recurse_nondet =
695+ get_fresh_local_typed_symexpr (" should_recurse_nondet" , bool_typet{});
696+ body.add (code_declt{should_recurse_nondet});
696697 exprt::operandst should_recurse_ops{
697698 binary_predicate_exprt{depth, ID_lt, get_symbol_expr (min_depth_var_name)},
698- side_effect_expr_nondett{bool_typet{}, source_locationt{}} };
699+ should_recurse_nondet };
699700 code_blockt then_case{};
700701
701702 code_assignt seen_assign_prev{};
@@ -737,34 +738,6 @@ code_blockt recursive_initializationt::build_pointer_constructor(
737738 return body;
738739}
739740
740- code_blockt recursive_initializationt::build_array_string_constructor (
741- const symbol_exprt &result) const
742- {
743- PRECONDITION (result.type ().id () == ID_pointer);
744- const typet &type = result.type ().subtype ();
745- PRECONDITION (type.id () == ID_array);
746- PRECONDITION (type.subtype () == char_type ());
747- const array_typet &array_type = to_array_type (type);
748- const auto array_size =
749- numeric_cast_v<std::size_t >(to_constant_expr (array_type.size ()));
750- code_blockt body{};
751-
752- for (std::size_t index = 0 ; index < array_size - 1 ; index++)
753- {
754- index_exprt index_expr{dereference_exprt{result},
755- from_integer (index, size_type ())};
756- body.add (code_assignt{
757- index_expr, side_effect_expr_nondett{char_type (), source_locationt{}}});
758- body.add (code_assumet{
759- notequal_exprt{index_expr, from_integer (0 , array_type.subtype ())}});
760- }
761- body.add (code_assignt{index_exprt{dereference_exprt{result},
762- from_integer (array_size - 1 , size_type ())},
763- from_integer (0 , array_type.subtype ())});
764-
765- return body;
766- }
767-
768741code_blockt recursive_initializationt::build_array_constructor (
769742 const exprt &depth,
770743 const symbol_exprt &result)
@@ -830,9 +803,10 @@ code_blockt recursive_initializationt::build_nondet_constructor(
830803{
831804 PRECONDITION (result.type ().id () == ID_pointer);
832805 code_blockt body{};
833- body.add (code_assignt{
834- dereference_exprt{result},
835- side_effect_expr_nondett{result.type ().subtype (), source_locationt{}}});
806+ auto const nondet_symbol =
807+ get_fresh_local_typed_symexpr (" nondet" , result.type ().subtype ());
808+ body.add (code_declt{nondet_symbol});
809+ body.add (code_assignt{dereference_exprt{result}, nondet_symbol});
836810 return body;
837811}
838812
@@ -1029,10 +1003,6 @@ code_blockt recursive_initializationt::build_function_pointer_constructor(
10291003 const auto function_pointer_selector =
10301004 get_fresh_local_symexpr (" function_pointer_selector" );
10311005 body.add (code_declt{function_pointer_selector});
1032- body.add (
1033- code_assignt{function_pointer_selector,
1034- side_effect_expr_nondett{function_pointer_selector.type (),
1035- source_locationt{}}});
10361006 auto function_pointer_index = std::size_t {0 };
10371007
10381008 for (const auto &target : targets)
0 commit comments