Skip to content

Commit da5193f

Browse files
author
Daniel Kroening
committed
avoid assert()
1 parent a55f33d commit da5193f

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

jbmc/src/java_bytecode/java_bytecode_convert_method.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1633,7 +1633,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
16331633
const typecast_exprt pointer(op[0], java_array_type(statement[0]));
16341634

16351635
dereference_exprt array(pointer, pointer.type().subtype());
1636-
assert(pointer.type().subtype().id() == ID_symbol_type);
1636+
PRECONDITION(pointer.type().subtype().id() == ID_symbol_type);
16371637
array.set(ID_java_member_access, true);
16381638

16391639
const member_exprt length(array, "length", java_int_type());

src/ansi-c/c_typecheck_initializer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ exprt::operandst::const_iterator c_typecheck_baset::do_designated_initializer(
492492

493493
const typet &type=designator.back().subtype;
494494
const typet &full_type=follow(type);
495-
assert(full_type.id() != ID_symbol_type);
495+
CHECK_RETURN(full_type.id() != ID_symbol_type);
496496

497497
// do we initialize a scalar?
498498
if(full_type.id()!=ID_struct &&

src/goto-instrument/goto_program2code.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1861,7 +1861,8 @@ void goto_program2codet::cleanup_expr(exprt &expr, bool no_typecast)
18611861
if(no_typecast)
18621862
return;
18631863

1864-
assert(expr.type().id() == ID_symbol_type);
1864+
DATA_INVARIANT(expr.type().id() == ID_symbol_type,
1865+
"type of union/struct expressions");
18651866

18661867
const typet &t=expr.type();
18671868

0 commit comments

Comments
 (0)