@@ -188,19 +188,22 @@ void goto_symex_statet::assignment(
188
188
const auto level2_it =
189
189
level2.current_names .emplace (l1_identifier, std::make_pair (lhs, 0 )).first ;
190
190
symex_renaming_levelt::increase_counter (level2_it);
191
- lhs = set_l2_indices (lhs, ns);
191
+ const renamedt<ssa_exprt, L2> l2_lhs = set_l2_indices (std::move (lhs), ns);
192
+ lhs = l2_lhs.get ();
192
193
193
194
// in case we happen to be multi-threaded, record the memory access
194
- bool is_shared= l2_thread_write_encoding (lhs , ns);
195
+ bool is_shared = l2_thread_write_encoding (l2_lhs. get () , ns);
195
196
196
197
if (run_validation_checks)
197
198
{
198
- DATA_INVARIANT (!check_renaming (lhs ), " lhs renaming failed on l2" );
199
+ DATA_INVARIANT (!check_renaming (l2_lhs. get () ), " lhs renaming failed on l2" );
199
200
DATA_INVARIANT (!check_renaming (rhs), " rhs renaming failed on l2" );
200
201
}
201
202
202
203
// see #305 on GitHub for a simple example and possible discussion
203
- if (is_shared && lhs.type ().id () == ID_pointer && !allow_pointer_unsoundness)
204
+ if (
205
+ is_shared && l2_lhs.get ().type ().id () == ID_pointer &&
206
+ !allow_pointer_unsoundness)
204
207
throw unsupported_operation_exceptiont (
205
208
" pointer handling for concurrency is unsound" );
206
209
@@ -216,7 +219,7 @@ void goto_symex_statet::assignment(
216
219
exprt l1_rhs (rhs);
217
220
get_l1_name (l1_rhs);
218
221
219
- ssa_exprt l1_lhs (lhs) ;
222
+ ssa_exprt l1_lhs{l2_lhs. get ()} ;
220
223
l1_lhs.remove_level_2 ();
221
224
222
225
if (run_validation_checks)
@@ -247,12 +250,10 @@ goto_symex_statet::set_l1_indices(ssa_exprt ssa_expr, const namespacet &ns)
247
250
return level1 (level0 (std::move (ssa_expr), ns, source.thread_nr ));
248
251
}
249
252
250
- ssa_exprt
253
+ renamedt< ssa_exprt, L2>
251
254
goto_symex_statet::set_l2_indices (ssa_exprt ssa_expr, const namespacet &ns)
252
255
{
253
- renamedt<ssa_exprt, L2> l2 =
254
- level2 (level1 (level0 (std::move (ssa_expr), ns, source.thread_nr )));
255
- return l2.get ();
256
+ return level2 (level1 (level0 (std::move (ssa_expr), ns, source.thread_nr )));
256
257
}
257
258
258
259
template <levelt level>
@@ -327,7 +328,11 @@ exprt goto_symex_statet::rename(exprt expr, const namespacet &ns)
327
328
if (p_it != propagation.end ())
328
329
expr=p_it->second ; // already L2
329
330
else
330
- ssa = set_l2_indices (ssa, ns);
331
+ {
332
+ const renamedt<ssa_exprt, L2> l2_ssa =
333
+ set_l2_indices (std::move (ssa), ns);
334
+ ssa = l2_ssa.get ();
335
+ }
331
336
}
332
337
}
333
338
}
@@ -441,8 +446,7 @@ bool goto_symex_statet::l2_thread_read_encoding(
441
446
if (!no_write.op ().is_false ())
442
447
cond |= guardt{no_write.op ()};
443
448
444
- if_exprt tmp (cond.as_expr (), ssa_l1, ssa_l1);
445
- tmp.true_case () = set_l2_indices (to_ssa_expr (tmp.true_case ()), ns);
449
+ const renamedt<ssa_exprt, L2> l2_true_case = set_l2_indices (ssa_l1, ns);
446
450
447
451
if (a_s_read.second .empty ())
448
452
{
@@ -452,8 +456,9 @@ bool goto_symex_statet::l2_thread_read_encoding(
452
456
symex_renaming_levelt::increase_counter (level2_it);
453
457
a_s_read.first =level2.current_count (l1_identifier);
454
458
}
459
+ const renamedt<ssa_exprt, L2> l2_false_case = set_l2_indices (ssa_l1, ns);
455
460
456
- to_ssa_expr ( tmp. false_case ()). set_level_2 (a_s_read. first ) ;
461
+ if_exprt tmp{cond. as_expr (), l2_true_case. get (), l2_false_case. get ()} ;
457
462
458
463
if (cond.is_false ())
459
464
{
@@ -475,7 +480,9 @@ bool goto_symex_statet::l2_thread_read_encoding(
475
480
source,
476
481
symex_targett::assignment_typet::PHI);
477
482
478
- expr = set_l2_indices (ssa_l1, ns);
483
+ const renamedt<ssa_exprt, L2> ssa_l2 =
484
+ set_l2_indices (std::move (ssa_l1), ns);
485
+ expr = ssa_l2.get ();
479
486
480
487
a_s_read.second .push_back (guard);
481
488
if (!no_write.op ().is_false ())
@@ -491,13 +498,16 @@ bool goto_symex_statet::l2_thread_read_encoding(
491
498
// No event and no fresh index, but avoid constant propagation
492
499
if (!record_events)
493
500
{
494
- expr = set_l2_indices (ssa_l1, ns);
501
+ const renamedt<ssa_exprt, L2> ssa_l2 =
502
+ set_l2_indices (std::move (ssa_l1), ns);
503
+ expr = ssa_l2.get ();
495
504
return true ;
496
505
}
497
506
498
507
// produce a fresh L2 name
499
508
symex_renaming_levelt::increase_counter (level2_it);
500
- expr = set_l2_indices (ssa_l1, ns);
509
+ const renamedt<ssa_exprt, L2> ssa_l2 = set_l2_indices (std::move (ssa_l1), ns);
510
+ expr = ssa_l2.get ();
501
511
502
512
// and record that
503
513
INVARIANT_STRUCTURED (
0 commit comments