@@ -296,14 +296,6 @@ exprt smt2_convt::get(const exprt &expr) const
296296 if (it!=identifier_map.end ())
297297 return it->second .value ;
298298 }
299- else if (expr.id ()==ID_member)
300- {
301- const member_exprt &member_expr=to_member_expr (expr);
302- exprt tmp=get (member_expr.struct_op ());
303- if (tmp.is_nil ())
304- return nil_exprt ();
305- return member_exprt (tmp, member_expr.get_component_name (), expr.type ());
306- }
307299 else if (expr.id () == ID_literal)
308300 {
309301 auto l = to_literal_expr (expr).get_literal ();
@@ -320,16 +312,23 @@ exprt smt2_convt::get(const exprt &expr) const
320312 else if (op.is_false ())
321313 return true_exprt ();
322314 }
323- else if (expr.is_constant ())
315+ else if (
316+ expr.is_constant () || expr.id () == ID_empty_union ||
317+ (!expr.has_operands () && (expr.id () == ID_struct || expr.id () == ID_array)))
318+ {
324319 return expr;
325- else if (const auto &array = expr_try_dynamic_cast<array_exprt>(expr))
320+ }
321+ else if (expr.has_operands ())
326322 {
327- exprt array_copy = *array ;
328- for (auto &element : array_copy .operands ())
323+ exprt copy = expr ;
324+ for (auto &op : copy .operands ())
329325 {
330- element = get (element);
326+ exprt eval_op = get (op);
327+ if (eval_op.is_nil ())
328+ return nil_exprt{};
329+ op = std::move (eval_op);
331330 }
332- return array_copy ;
331+ return copy ;
333332 }
334333
335334 return nil_exprt ();
@@ -4793,7 +4792,9 @@ void smt2_convt::set_to(const exprt &expr, bool value)
47934792 const irep_idt &identifier=
47944793 to_symbol_expr (equal_expr.lhs ()).get_identifier ();
47954794
4796- if (identifier_map.find (identifier)==identifier_map.end ())
4795+ if (
4796+ identifier_map.find (identifier) == identifier_map.end () &&
4797+ equal_expr.lhs () != equal_expr.rhs ())
47974798 {
47984799 identifiert &id=identifier_map[identifier];
47994800 CHECK_RETURN (id.type .is_nil ());
0 commit comments