@@ -249,16 +249,16 @@ goto_symext::cache_dereference(exprt &dereference_result, statet &state)
249
249
// / goto_symext::address_arithmetic) and certain common expression patterns
250
250
// / such as `&struct.flexible_array[0]` (see inline comments in code).
251
251
// / Note that \p write is used to alter behaviour when this function is
252
- // / operating on the LHS of an assignment. Similarly \p is_in_quantifier
253
- // / indicates when the dereference is inside a quantifier (related to scoping
254
- // / when dereference caching is enabled).
252
+ // / operating on the LHS of an assignment. Similarly \p is_in_binding_expression
253
+ // / indicates when the dereference is inside a binding expression (related to
254
+ // / scoping when dereference caching is enabled).
255
255
// / For full details of this method's pointer replacement and potential side-
256
256
// / effects see \ref goto_symext::dereference
257
257
void goto_symext::dereference_rec (
258
258
exprt &expr,
259
259
statet &state,
260
260
bool write,
261
- bool is_in_quantifier )
261
+ bool is_in_binding_expression )
262
262
{
263
263
if (expr.id ()==ID_dereference)
264
264
{
@@ -281,7 +281,7 @@ void goto_symext::dereference_rec(
281
281
tmp1.swap (to_dereference_expr (expr).pointer ());
282
282
283
283
// first make sure there are no dereferences in there
284
- dereference_rec (tmp1, state, false , is_in_quantifier );
284
+ dereference_rec (tmp1, state, false , is_in_binding_expression );
285
285
286
286
// Depending on the nature of the pointer expression, the recursive deref
287
287
// operation might have introduced a construct such as
@@ -345,7 +345,7 @@ void goto_symext::dereference_rec(
345
345
// (p == &something ? something : ...))
346
346
// Otherwise we should just return it unchanged.
347
347
if (
348
- symex_config.cache_dereferences && !write && !is_in_quantifier &&
348
+ symex_config.cache_dereferences && !write && !is_in_binding_expression &&
349
349
(tmp2.id () == ID_if || tmp2.id () == ID_let))
350
350
{
351
351
expr = cache_dereference (tmp2, state);
@@ -372,7 +372,7 @@ void goto_symext::dereference_rec(
372
372
tmp.add_source_location ()=expr.source_location ();
373
373
374
374
// recursive call
375
- dereference_rec (tmp, state, write , is_in_quantifier );
375
+ dereference_rec (tmp, state, write , is_in_binding_expression );
376
376
377
377
expr.swap (tmp);
378
378
}
@@ -406,18 +406,22 @@ void goto_symext::dereference_rec(
406
406
expr = address_of_exprt (index_exprt (
407
407
to_address_of_expr (tc_op).object (), from_integer (0 , c_index_type ())));
408
408
409
- dereference_rec (expr, state, write , is_in_quantifier );
409
+ dereference_rec (expr, state, write , is_in_binding_expression );
410
410
}
411
411
else
412
412
{
413
- dereference_rec (tc_op, state, write , is_in_quantifier );
413
+ dereference_rec (tc_op, state, write , is_in_binding_expression );
414
414
}
415
415
}
416
416
else
417
417
{
418
- bool is_quantifier = expr.id () == ID_forall || expr.id () == ID_exists;
418
+ bool is_binding_expression =
419
+ can_cast_expr<binding_exprt>(expr) || can_cast_expr<let_exprt>(expr);
419
420
Forall_operands (it, expr)
420
- dereference_rec (*it, state, write , is_in_quantifier || is_quantifier);
421
+ {
422
+ dereference_rec (
423
+ *it, state, write , is_in_binding_expression || is_binding_expression);
424
+ }
421
425
}
422
426
}
423
427
0 commit comments