Skip to content

Commit e16acf8

Browse files
Cleanup invariants in remove_vector
1 parent f43af3c commit e16acf8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/goto-programs/remove_vector.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,14 @@ static void remove_vector(exprt &expr)
8282
expr.id()==ID_mod || expr.id()==ID_bitxor ||
8383
expr.id()==ID_bitand || expr.id()==ID_bitor)
8484
{
85+
DATA_INVARIANT(
86+
expr.operands().size() == 2, "binary operators have 2 operands");
8587
remove_vector(expr.type());
8688
array_typet array_type=to_array_type(expr.type());
8789

8890
mp_integer dimension;
8991
to_integer(array_type.size(), dimension);
9092

91-
assert(expr.operands().size()==2);
9293
const typet subtype=array_type.subtype();
9394
// do component-wise:
9495
// x+y -> vector(x[0]+y[0],x[1]+y[1],...)
@@ -108,13 +109,14 @@ static void remove_vector(exprt &expr)
108109
}
109110
else if(expr.id()==ID_unary_minus || expr.id()==ID_bitnot)
110111
{
112+
DATA_INVARIANT(
113+
expr.operands().size() == 1, "unary operators have one operand");
111114
remove_vector(expr.type());
112115
array_typet array_type=to_array_type(expr.type());
113116

114117
mp_integer dimension;
115118
to_integer(array_type.size(), dimension);
116119

117-
assert(expr.operands().size()==1);
118120
const typet subtype=array_type.subtype();
119121
// do component-wise:
120122
// -x -> vector(-x[0],-x[1],...)

0 commit comments

Comments
 (0)