@@ -165,32 +165,6 @@ static bool check_renaming(const exprt &expr)
165165 return false ;
166166}
167167
168- static void assert_l1_renaming (const exprt &expr)
169- {
170- #if 1
171- if (check_renaming_l1 (expr))
172- {
173- std::cerr << expr.pretty () << ' \n ' ;
174- UNREACHABLE;
175- }
176- #else
177- (void)expr;
178- #endif
179- }
180-
181- static void assert_l2_renaming (const exprt &expr)
182- {
183- #if 1
184- if (check_renaming (expr))
185- {
186- std::cerr << expr.pretty () << ' \n ' ;
187- UNREACHABLE;
188- }
189- #else
190- (void)expr;
191- #endif
192- }
193-
194168class goto_symex_is_constantt : public is_constantt
195169{
196170protected:
@@ -241,15 +215,19 @@ void goto_symex_statet::assignment(
241215 // the type might need renaming
242216 rename (lhs.type (), l1_identifier, ns);
243217 lhs.update_type ();
244- assert_l1_renaming (lhs);
245-
246- #if 0
218+ const validation_modet local_validation_mode = validation_modet::INVARIANT;
219+ if (run_validation_checks)
220+ {
221+ const validation_modet vm = local_validation_mode;
222+ DATA_CHECK (!check_renaming_l1 (lhs), " lhs renaming failed on l1" );
223+ }
224+ #if 0
247225 PRECONDITION(l1_identifier != get_original_name(l1_identifier)
248226 || l1_identifier=="goto_symex::\\guard"
249227 || ns.lookup(l1_identifier).is_shared()
250228 || has_prefix(id2string(l1_identifier), "symex::invalid_object")
251229 || has_prefix(id2string(l1_identifier), "symex_dynamic::dynamic_object"));
252- #endif
230+ #endif
253231
254232 // do the l2 renaming
255233 if (level2.current_names .find (l1_identifier)==level2.current_names .end ())
@@ -260,9 +238,12 @@ void goto_symex_statet::assignment(
260238 // in case we happen to be multi-threaded, record the memory access
261239 bool is_shared=l2_thread_write_encoding (lhs, ns);
262240
263- assert_l2_renaming (lhs);
264- assert_l2_renaming (rhs);
265-
241+ if (run_validation_checks)
242+ {
243+ const validation_modet vm = local_validation_mode;
244+ DATA_CHECK (!check_renaming (lhs), " lhs renaming failed on l2" );
245+ DATA_CHECK (!check_renaming (rhs), " rhs renaming failed on l2" );
246+ }
266247 // see #305 on GitHub for a simple example and possible discussion
267248 if (is_shared && lhs.type ().id () == ID_pointer && !allow_pointer_unsoundness)
268249 throw unsupported_operation_exceptiont (
@@ -284,8 +265,12 @@ void goto_symex_statet::assignment(
284265 ssa_exprt l1_lhs (lhs);
285266 get_l1_name (l1_lhs);
286267
287- assert_l1_renaming (l1_lhs);
288- assert_l1_renaming (l1_rhs);
268+ if (run_validation_checks)
269+ {
270+ const validation_modet vm = local_validation_mode;
271+ DATA_CHECK (!check_renaming_l1 (l1_lhs), " lhs renaming failed on l1" );
272+ DATA_CHECK (!check_renaming_l1 (l1_rhs), " rhs renaming failed on l1" );
273+ }
289274
290275 value_set.assign (l1_lhs, l1_rhs, ns, rhs_is_simplified, is_shared);
291276 }
0 commit comments