@@ -91,7 +91,7 @@ exprt goto_symext::add_to_lhs(
9191 const exprt &lhs,
9292 const exprt &what)
9393{
94- assert (lhs.id ()!= ID_symbol);
94+ PRECONDITION (lhs.id () != ID_symbol);
9595 exprt tmp_what=what;
9696
9797 if (tmp_what.id ()!=ID_symbol)
@@ -172,7 +172,9 @@ void goto_symext::symex_assign_rec(
172172 lhs.id ()==ID_complex_imag)
173173 {
174174 // this is stuff like __real__ x = 1;
175- assert (lhs.operands ().size ()==1 );
175+ DATA_INVARIANT (
176+ lhs.operands ().size () == 1 ,
177+ " exprts with id ID_complex_real or ID_complex_imag take one operand." );
176178
177179 exprt new_rhs=exprt (ID_complex, lhs.op0 ().type ());
178180 new_rhs.operands ().resize (2 );
@@ -283,7 +285,7 @@ void goto_symext::symex_assign_typecast(
283285{
284286 // these may come from dereferencing on the lhs
285287
286- assert (lhs.operands ().size ()== 1 );
288+ PRECONDITION (lhs.operands ().size () == 1 );
287289
288290 exprt rhs_typecasted=rhs;
289291 rhs_typecasted.make_typecast (lhs.op0 ().type ());
@@ -305,9 +307,7 @@ void goto_symext::symex_assign_array(
305307 // lhs must be index operand
306308 // that takes two operands: the first must be an array
307309 // the second is the index
308-
309- if (lhs.operands ().size ()!=2 )
310- throw " index must have two operands" ;
310+ DATA_INVARIANT (lhs.operands ().size () == 2 , " index_exprt takes two operands" );
311311
312312 const exprt &lhs_array=lhs.array ();
313313 const exprt &lhs_index=lhs.index ();
@@ -368,7 +368,8 @@ void goto_symext::symex_assign_struct_member(
368368 // typecasts involved? C++ does that for inheritance.
369369 if (lhs_struct.id ()==ID_typecast)
370370 {
371- assert (lhs_struct.operands ().size ()==1 );
371+ DATA_INVARIANT (
372+ lhs_struct.operands ().size () == 1 , " typecast_exprt takes one operand." );
372373
373374 if (lhs_struct.op0 ().id () == ID_null_object)
374375 {
0 commit comments