@@ -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)
@@ -170,8 +170,8 @@ void goto_symext::symex_assign_rec(
170170 }
171171 else if (lhs.id () == ID_complex_real)
172172 {
173+ // this is stuff like __real__ x = 1;
173174 const complex_real_exprt &complex_real_expr = to_complex_real_expr (lhs);
174-
175175 const complex_imag_exprt complex_imag_expr (complex_real_expr.op ());
176176
177177 complex_exprt new_rhs (
@@ -284,7 +284,7 @@ void goto_symext::symex_assign_typecast(
284284{
285285 // these may come from dereferencing on the lhs
286286
287- assert (lhs.operands ().size ()== 1 );
287+ PRECONDITION (lhs.operands ().size () == 1 );
288288
289289 exprt rhs_typecasted=rhs;
290290 rhs_typecasted.make_typecast (lhs.op0 ().type ());
@@ -306,9 +306,7 @@ void goto_symext::symex_assign_array(
306306 // lhs must be index operand
307307 // that takes two operands: the first must be an array
308308 // the second is the index
309-
310- if (lhs.operands ().size ()!=2 )
311- throw " index must have two operands" ;
309+ DATA_INVARIANT (lhs.operands ().size () == 2 , " index_exprt takes two operands" );
312310
313311 const exprt &lhs_array=lhs.array ();
314312 const exprt &lhs_index=lhs.index ();
@@ -369,7 +367,8 @@ void goto_symext::symex_assign_struct_member(
369367 // typecasts involved? C++ does that for inheritance.
370368 if (lhs_struct.id ()==ID_typecast)
371369 {
372- assert (lhs_struct.operands ().size ()==1 );
370+ DATA_INVARIANT (
371+ lhs_struct.operands ().size () == 1 , " typecast_exprt takes one operand." );
373372
374373 if (lhs_struct.op0 ().id () == ID_null_object)
375374 {
0 commit comments