9
9
// / \file
10
10
// / Symbolic Execution
11
11
12
+ #include < iostream>
13
+ #include < util/format_expr.h>
14
+
12
15
#include " goto_symex.h"
13
16
14
17
#include < util/arith_tools.h>
@@ -128,7 +131,7 @@ void goto_symext::symex_other(
128
131
statement==ID_array_replace)
129
132
{
130
133
// array_copy and array_replace take two pointers (to arrays); we need to:
131
- // 1. dereference the pointers (via clean_expr)
134
+ // 1. remove any dereference expressions (via clean_expr)
132
135
// 2. find the actual array objects/candidates for objects (via
133
136
// process_array_expr)
134
137
// 3. build an assignment where the type on lhs and rhs is:
@@ -139,14 +142,14 @@ void goto_symext::symex_other(
139
142
" expected array_copy/array_replace statement to have two operands" );
140
143
141
144
// we need to add dereferencing for both operands
142
- dereference_exprt dest_array (code.op0 ());
143
- clean_expr (dest_array, state, true );
144
- dereference_exprt src_array (code.op1 ());
145
+ exprt dest_array (code.op0 ());
146
+ clean_expr (dest_array, state, false );
147
+ exprt src_array (code.op1 ());
145
148
clean_expr (src_array, state, false );
146
149
147
150
// obtain the actual arrays
148
- process_array_expr (dest_array);
149
- process_array_expr (src_array);
151
+ process_array_expr (state, dest_array, true );
152
+ process_array_expr (state, src_array, false );
150
153
151
154
// check for size (or type) mismatch and adjust
152
155
if (!base_type_eq (dest_array.type (), src_array.type (), ns))
@@ -181,7 +184,7 @@ void goto_symext::symex_other(
181
184
{
182
185
// array_set takes a pointer (to an array) and a value that each element
183
186
// should be set to; we need to:
184
- // 1. dereference the pointer (via clean_expr)
187
+ // 1. remove any dereference expressions (via clean_expr)
185
188
// 2. find the actual array object/candidates for objects (via
186
189
// process_array_expr)
187
190
// 3. use the type of the resulting array to construct an array_of
@@ -191,11 +194,11 @@ void goto_symext::symex_other(
191
194
" expected array_set statement to have two operands" );
192
195
193
196
// we need to add dereferencing for the first operand
194
- exprt array_expr = dereference_exprt (code.op0 ());
195
- clean_expr (array_expr, state, true );
197
+ exprt array_expr (code.op0 ());
198
+ clean_expr (array_expr, state, false );
196
199
197
200
// obtain the actual array(s)
198
- process_array_expr (array_expr);
201
+ process_array_expr (state, array_expr, true );
199
202
200
203
// prepare to build the array_of
201
204
exprt value = code.op1 ();
@@ -227,7 +230,7 @@ void goto_symext::symex_other(
227
230
{
228
231
// array_equal takes two pointers (to arrays) and the symbol that the result
229
232
// should get assigned to; we need to:
230
- // 1. dereference the pointers (via clean_expr)
233
+ // 1. remove any dereference expressions (via clean_expr)
231
234
// 2. find the actual array objects/candidates for objects (via
232
235
// process_array_expr)
233
236
// 3. build an assignment where the lhs is the previous third argument, and
@@ -238,14 +241,14 @@ void goto_symext::symex_other(
238
241
" expected array_equal statement to have three operands" );
239
242
240
243
// we need to add dereferencing for the first two
241
- dereference_exprt array1 (code.op0 ());
244
+ exprt array1 (code.op0 ());
242
245
clean_expr (array1, state, false );
243
- dereference_exprt array2 (code.op1 ());
246
+ exprt array2 (code.op1 ());
244
247
clean_expr (array2, state, false );
245
248
246
249
// obtain the actual arrays
247
- process_array_expr (array1);
248
- process_array_expr (array2);
250
+ process_array_expr (state, array1, false );
251
+ process_array_expr (state, array2, false );
249
252
250
253
code_assignt assignment (code.op2 (), equal_exprt (array1, array2));
251
254
@@ -271,10 +274,10 @@ void goto_symext::symex_other(
271
274
code.operands ().size () == 1 ,
272
275
" expected havoc_object statement to have one operand" );
273
276
274
- // we need to add dereferencing for the first operand
275
- dereference_exprt object (code.op0 (), empty_typet ());
276
- clean_expr (object, state, true );
277
+ exprt object (code.op0 ());
278
+ clean_expr (object, state, false );
277
279
280
+ process_array_expr (state, object, true );
278
281
havoc_rec (state, guardt (true_exprt ()), object);
279
282
}
280
283
else
0 commit comments