Skip to content

Commit 3779e52

Browse files
Replace throw with invariant in boolbv_if
1 parent 9ef62d8 commit 3779e52

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/solvers/flattening/boolbv_if.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ bvt boolbvt::convert_if(const if_exprt &expr)
2121
const bvt &true_case_bv = convert_bv(expr.true_case());
2222
const bvt &false_case_bv = convert_bv(expr.false_case());
2323

24-
if(true_case_bv.size() != width || false_case_bv.size() != width)
25-
throw "operand size mismatch for if "+expr.pretty();
24+
DATA_INVARIANT_WITH_DIAGNOSTICS(
25+
true_case_bv.size() == width && false_case_bv.size() == width,
26+
"both branches of an if statement have to return bit vectors of the same "
27+
"width",
28+
irep_pretty_diagnosticst{expr});
2629

2730
return bv_utils.select(cond, true_case_bv, false_case_bv);
2831
}

0 commit comments

Comments
 (0)