2727#include < util/pointer_predicates.h>
2828#include < util/cprover_prefix.h>
2929#include < util/options.h>
30+ #include < util/invariant.h>
3031
3132#include " local_bitvector_analysis.h"
3233
@@ -1658,24 +1659,23 @@ void goto_checkt::goto_check(
16581659 {
16591660 if (enable_pointer_check)
16601661 {
1661- assert (i.code .operands ().size ()== 1 );
1662+ INVARIANT (i.code .operands ().size () == 1 , " The num-operands must be 1. " );
16621663 const symbol_exprt &variable=to_symbol_expr (i.code .op0 ());
16631664
16641665 // is it dirty?
16651666 if (local_bitvector_analysis->dirty (variable))
16661667 {
16671668 // need to mark the dead variable as dead
16681669 goto_programt::targett t=new_code.add_instruction (ASSIGN);
1669- exprt address_of_expr= address_of_exprt (variable);
1670+ exprt address_of_expr = address_of_exprt (variable);
16701671 exprt lhs=ns.lookup (CPROVER_PREFIX " dead_object" ).symbol_expr ();
16711672 if (!base_type_eq (lhs.type (), address_of_expr.type (), ns))
16721673 address_of_expr.make_typecast (lhs.type ());
1673- exprt rhs=
1674- if_exprt (
1675- side_effect_expr_nondett (bool_typet ()),
1676- address_of_expr,
1677- lhs,
1678- lhs.type ());
1674+ exprt rhs = if_exprt (
1675+ side_effect_expr_nondett (bool_typet ()),
1676+ address_of_expr,
1677+ lhs,
1678+ lhs.type ());
16791679 t->source_location =i.source_location ;
16801680 t->code =code_assignt (lhs, rhs);
16811681 t->code .add_source_location ()=i.source_location ;
@@ -1686,27 +1686,26 @@ void goto_checkt::goto_check(
16861686 {
16871687 if (enable_pointer_check)
16881688 {
1689- assert (i.code .operands ().size ()== 1 );
1690- const symbol_exprt &variable= to_symbol_expr (i.code .op0 ());
1689+ INVARIANT (i.code .operands ().size () == 1 , " There must be 1 operand. " );
1690+ const symbol_exprt &variable = to_symbol_expr (i.code .op0 ());
16911691
16921692 // is it dirty?
16931693 if (local_bitvector_analysis->dirty (variable))
16941694 {
16951695 // reset the dead marker
1696- goto_programt::targett t= new_code.add_instruction (ASSIGN);
1697- exprt address_of_expr= address_of_exprt (variable);
1698- exprt lhs= ns.lookup (CPROVER_PREFIX " dead_object" ).symbol_expr ();
1696+ goto_programt::targett t = new_code.add_instruction (ASSIGN);
1697+ exprt address_of_expr = address_of_exprt (variable);
1698+ exprt lhs = ns.lookup (CPROVER_PREFIX " dead_object" ).symbol_expr ();
16991699 if (!base_type_eq (lhs.type (), address_of_expr.type (), ns))
17001700 address_of_expr.make_typecast (lhs.type ());
1701- exprt rhs=
1702- if_exprt (
1703- equal_exprt (lhs, address_of_expr),
1704- null_pointer_exprt (to_pointer_type (address_of_expr.type ())),
1705- lhs,
1706- lhs.type ());
1707- t->source_location =i.source_location ;
1708- t->code =code_assignt (lhs, rhs);
1709- t->code .add_source_location ()=i.source_location ;
1701+ exprt rhs = if_exprt (
1702+ equal_exprt (lhs, address_of_expr),
1703+ null_pointer_exprt (to_pointer_type (address_of_expr.type ())),
1704+ lhs,
1705+ lhs.type ());
1706+ t->source_location = i.source_location ;
1707+ t->code = code_assignt (lhs, rhs);
1708+ t->code .add_source_location () = i.source_location ;
17101709 }
17111710 }
17121711 }
0 commit comments