@@ -188,19 +188,20 @@ 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 (is_shared && l2_lhs. get () .type ().id () == ID_pointer && !allow_pointer_unsoundness)
204
205
throw unsupported_operation_exceptiont (
205
206
" pointer handling for concurrency is unsound" );
206
207
@@ -216,7 +217,7 @@ void goto_symex_statet::assignment(
216
217
exprt l1_rhs (rhs);
217
218
get_l1_name (l1_rhs);
218
219
219
- ssa_exprt l1_lhs (lhs) ;
220
+ ssa_exprt l1_lhs{l2_lhs. get ()} ;
220
221
l1_lhs.remove_level_2 ();
221
222
222
223
if (run_validation_checks)
@@ -249,13 +250,11 @@ renamedt<ssa_exprt, L1> goto_symex_statet::set_l1_indices(
249
250
return level1 (level0 (std::move (ssa_expr), ns, source.thread_nr ));
250
251
}
251
252
252
- ssa_exprt goto_symex_statet::set_l2_indices (
253
+ renamedt< ssa_exprt, L2> goto_symex_statet::set_l2_indices (
253
254
ssa_exprt ssa_expr,
254
255
const namespacet &ns)
255
256
{
256
- renamedt<ssa_exprt, L2> l2 =
257
- level2 (level1 (level0 (std::move (ssa_expr), ns, source.thread_nr )));
258
- return l2.get ();
257
+ return level2 (level1 (level0 (std::move (ssa_expr), ns, source.thread_nr )));
259
258
}
260
259
261
260
template <levelt level>
@@ -330,7 +329,11 @@ exprt goto_symex_statet::rename(exprt expr, const namespacet &ns)
330
329
if (p_it != propagation.end ())
331
330
expr=p_it->second ; // already L2
332
331
else
333
- ssa = set_l2_indices (ssa, ns);
332
+ {
333
+ const renamedt<ssa_exprt, L2> l2_ssa =
334
+ set_l2_indices (std::move (ssa), ns);
335
+ ssa = l2_ssa.get ();
336
+ }
334
337
}
335
338
}
336
339
}
@@ -444,8 +447,7 @@ bool goto_symex_statet::l2_thread_read_encoding(
444
447
if (!no_write.op ().is_false ())
445
448
cond |= guardt{no_write.op ()};
446
449
447
- if_exprt tmp (cond.as_expr (), ssa_l1, ssa_l1);
448
- tmp.true_case () = set_l2_indices (to_ssa_expr (tmp.true_case ()), ns);
450
+ const renamedt<ssa_exprt, L2> l2_true_case = set_l2_indices (ssa_l1, ns);
449
451
450
452
if (a_s_read.second .empty ())
451
453
{
@@ -455,8 +457,9 @@ bool goto_symex_statet::l2_thread_read_encoding(
455
457
symex_renaming_levelt::increase_counter (level2_it);
456
458
a_s_read.first =level2.current_count (l1_identifier);
457
459
}
460
+ const renamedt<ssa_exprt, L2> l2_false_case = set_l2_indices (ssa_l1, ns);
458
461
459
- to_ssa_expr ( tmp. false_case ()). set_level_2 (a_s_read. first ) ;
462
+ if_exprt tmp{cond. as_expr (), l2_true_case. get (), l2_false_case. get ()} ;
460
463
461
464
if (cond.is_false ())
462
465
{
@@ -478,7 +481,9 @@ bool goto_symex_statet::l2_thread_read_encoding(
478
481
source,
479
482
symex_targett::assignment_typet::PHI);
480
483
481
- expr = set_l2_indices (ssa_l1, ns);
484
+ const renamedt<ssa_exprt, L2> ssa_l2 =
485
+ set_l2_indices (std::move (ssa_l1), ns);
486
+ expr = ssa_l2.get ();
482
487
483
488
a_s_read.second .push_back (guard);
484
489
if (!no_write.op ().is_false ())
@@ -494,13 +499,16 @@ bool goto_symex_statet::l2_thread_read_encoding(
494
499
// No event and no fresh index, but avoid constant propagation
495
500
if (!record_events)
496
501
{
497
- expr = set_l2_indices (ssa_l1, ns);
502
+ const renamedt<ssa_exprt, L2> ssa_l2 =
503
+ set_l2_indices (std::move (ssa_l1), ns);
504
+ expr = ssa_l2.get ();
498
505
return true ;
499
506
}
500
507
501
508
// produce a fresh L2 name
502
509
symex_renaming_levelt::increase_counter (level2_it);
503
- expr = set_l2_indices (ssa_l1, ns);
510
+ const renamedt<ssa_exprt, L2> ssa_l2 = set_l2_indices (std::move (ssa_l1), ns);
511
+ expr = ssa_l2.get ();
504
512
505
513
// and record that
506
514
INVARIANT_STRUCTURED (
0 commit comments