Skip to content

Commit f2a7a37

Browse files
committed
Some more changes.
1 parent 46aeea4 commit f2a7a37

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/goto-symex/symex_assign.cpp

+8-9
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ void goto_symext::symex_assign(
4141
!side_effect_expr.operands().empty(),
4242
"function call stamement expects non-empty list of side effects");
4343

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");
4647

4748
const irep_idt &identifier=
4849
to_symbol_expr(side_effect_expr.op0()).get_identifier();
@@ -63,7 +64,7 @@ void goto_symext::symex_assign(
6364
else if(statement==ID_gcc_builtin_va_arg_next)
6465
symex_gcc_builtin_va_arg_next(state, lhs, side_effect_expr);
6566
else
66-
throw "symex_assign: unexpected side effect: "+id2string(statement);
67+
UNREACHABLE;
6768
}
6869
else
6970
{
@@ -313,11 +314,9 @@ void goto_symext::symex_assign_array(
313314

314315
const exprt &lhs_array=lhs.array();
315316
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());
317318

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);
321320

322321
#ifdef USE_UPDATE
323322

@@ -326,7 +325,7 @@ void goto_symext::symex_assign_array(
326325
// into
327326
// a'==UPDATE(a, [i], e)
328327

329-
update_exprt new_rhs(lhs_type);
328+
update_exprt new_rhs(lhs_index_type);
330329
new_rhs.old()=lhs_array;
331330
new_rhs.designator().push_back(index_designatort(lhs_index));
332331
new_rhs.new_value()=rhs;
@@ -343,7 +342,7 @@ void goto_symext::symex_assign_array(
343342
// a'==a WITH [i:=e]
344343

345344
with_exprt new_rhs(lhs_array, lhs_index, rhs);
346-
new_rhs.type() = lhs_type;
345+
new_rhs.type() = lhs_index_type;
347346

348347
exprt new_full_lhs=add_to_lhs(full_lhs, lhs);
349348

src/goto-symex/symex_start_thread.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void goto_symext::symex_start_thread(statet &state)
2727

2828
const goto_programt::instructiont &instruction=*state.source.pc;
2929

30-
INVARIANT(instruction.targets.size()==1,
30+
INVARIANT(instruction.targets.size() == 1,
3131
"start_thread expects one target");
3232

3333
goto_programt::const_targett thread_target=

0 commit comments

Comments
 (0)