@@ -49,6 +49,7 @@ void goto_convertt::remove_assignment(
49
49
if (statement==ID_assign)
50
50
{
51
51
auto &old_assignment = to_side_effect_expr_assign (expr);
52
+ exprt new_lhs = skip_typecast (old_assignment.lhs ());
52
53
53
54
if (
54
55
result_is_used && !address_taken &&
@@ -57,10 +58,10 @@ void goto_convertt::remove_assignment(
57
58
if (!old_assignment.rhs ().is_constant ())
58
59
make_temp_symbol (old_assignment.rhs (), " assign" , dest, mode);
59
60
60
- replacement_expr_opt = old_assignment.rhs ();
61
+ replacement_expr_opt =
62
+ typecast_exprt::conditional_cast (old_assignment.rhs (), new_lhs.type ());
61
63
}
62
64
63
- exprt new_lhs = skip_typecast (old_assignment.lhs ());
64
65
exprt new_rhs =
65
66
typecast_exprt::conditional_cast (old_assignment.rhs (), new_lhs.type ());
66
67
code_assignt new_assignment (std::move (new_lhs), std::move (new_rhs));
@@ -115,6 +116,7 @@ void goto_convertt::remove_assignment(
115
116
}
116
117
117
118
const binary_exprt &binary_expr = to_binary_expr (expr);
119
+ exprt new_lhs = skip_typecast (binary_expr.op0 ());
118
120
const typet &op0_type = binary_expr.op0 ().type ();
119
121
120
122
PRECONDITION (
@@ -129,10 +131,10 @@ void goto_convertt::remove_assignment(
129
131
assignment_lhs_needs_temporary (binary_expr.op0 ()))
130
132
{
131
133
make_temp_symbol (rhs, " assign" , dest, mode);
132
- replacement_expr_opt = rhs;
134
+ replacement_expr_opt =
135
+ typecast_exprt::conditional_cast (rhs, new_lhs.type ());
133
136
}
134
137
135
- exprt new_lhs = skip_typecast (binary_expr.op0 ());
136
138
rhs = typecast_exprt::conditional_cast (rhs, new_lhs.type ());
137
139
rhs.add_source_location () = expr.source_location ();
138
140
code_assignt assignment (new_lhs, rhs);
0 commit comments