@@ -169,11 +169,11 @@ void recursive_initializationt::initialize(
169
169
goto_model.symbol_table .lookup_ref (fun_name);
170
170
const auto proper_init_case = code_function_callt{
171
171
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});
173
175
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});
177
177
}
178
178
else
179
179
{
@@ -265,9 +265,7 @@ code_blockt recursive_initializationt::build_constructor_body(
265
265
}
266
266
if (lhs_name.has_value ())
267
267
{
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))
271
269
{
272
270
CHECK_RETURN (size_symbol.has_value ());
273
271
return build_dynamic_array_constructor (
@@ -693,9 +691,12 @@ code_blockt recursive_initializationt::build_pointer_constructor(
693
691
code_blockt null_and_return{{assign_null, code_returnt{}}};
694
692
body.add (code_ifthenelset{conjunction (should_not_recurse), null_and_return});
695
693
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});
696
697
exprt::operandst should_recurse_ops{
697
698
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 };
699
700
code_blockt then_case{};
700
701
701
702
code_assignt seen_assign_prev{};
@@ -737,34 +738,6 @@ code_blockt recursive_initializationt::build_pointer_constructor(
737
738
return body;
738
739
}
739
740
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
-
768
741
code_blockt recursive_initializationt::build_array_constructor (
769
742
const exprt &depth,
770
743
const symbol_exprt &result)
@@ -830,9 +803,10 @@ code_blockt recursive_initializationt::build_nondet_constructor(
830
803
{
831
804
PRECONDITION (result.type ().id () == ID_pointer);
832
805
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});
836
810
return body;
837
811
}
838
812
@@ -1029,10 +1003,6 @@ code_blockt recursive_initializationt::build_function_pointer_constructor(
1029
1003
const auto function_pointer_selector =
1030
1004
get_fresh_local_symexpr (" function_pointer_selector" );
1031
1005
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{}}});
1036
1006
auto function_pointer_index = std::size_t {0 };
1037
1007
1038
1008
for (const auto &target : targets)
0 commit comments