@@ -41,8 +41,9 @@ void goto_symext::symex_assign(
41
41
!side_effect_expr.operands ().empty (),
42
42
" function call stamement expects non-empty list of side effects" );
43
43
44
- if (side_effect_expr.op0 ().id ()!=ID_symbol)
45
- throw " symex_assign: expected symbol as function" ;
44
+ DATA_INVARIANT (
45
+ side_effect_expr.op0 ().id () == ID_symbol,
46
+ " expected symbol as function" );
46
47
47
48
const irep_idt &identifier=
48
49
to_symbol_expr (side_effect_expr.op0 ()).get_identifier ();
@@ -63,7 +64,7 @@ void goto_symext::symex_assign(
63
64
else if (statement==ID_gcc_builtin_va_arg_next)
64
65
symex_gcc_builtin_va_arg_next (state, lhs, side_effect_expr);
65
66
else
66
- throw " symex_assign: unexpected side effect: " + id2string (statement) ;
67
+ UNREACHABLE ;
67
68
}
68
69
else
69
70
{
@@ -313,11 +314,9 @@ void goto_symext::symex_assign_array(
313
314
314
315
const exprt &lhs_array=lhs.array ();
315
316
const exprt &lhs_index=lhs.index ();
316
- const typet &lhs_type =ns.follow (lhs_array.type ());
317
+ const typet &lhs_index_type =ns.follow (lhs_array.type ());
317
318
318
- if (lhs_type.id ()!=ID_array)
319
- throw " index must take array type operand, but got `" +
320
- lhs_type.id_string ()+" '" ;
319
+ PRECONDITION (lhs_index_type.id () == ID_array);
321
320
322
321
#ifdef USE_UPDATE
323
322
@@ -326,7 +325,7 @@ void goto_symext::symex_assign_array(
326
325
// into
327
326
// a'==UPDATE(a, [i], e)
328
327
329
- update_exprt new_rhs (lhs_type );
328
+ update_exprt new_rhs (lhs_index_type );
330
329
new_rhs.old ()=lhs_array;
331
330
new_rhs.designator ().push_back (index_designatort (lhs_index));
332
331
new_rhs.new_value ()=rhs;
@@ -343,7 +342,7 @@ void goto_symext::symex_assign_array(
343
342
// a'==a WITH [i:=e]
344
343
345
344
with_exprt new_rhs (lhs_array, lhs_index, rhs);
346
- new_rhs.type () = lhs_type ;
345
+ new_rhs.type () = lhs_index_type ;
347
346
348
347
exprt new_full_lhs=add_to_lhs (full_lhs, lhs);
349
348
0 commit comments