Skip to content

Commit bd2558b

Browse files
Use to_plus_expr instead of assert in simplify_plus
to_plus_expr should check if an expression is a plus_exprt, this avoids duplicating checks across the codebase
1 parent e4cfc2f commit bd2558b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/util/simplify_expr_int.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,8 @@ bool simplify_exprt::simplify_mod(exprt &expr)
446446

447447
bool simplify_exprt::simplify_plus(exprt &expr)
448448
{
449+
// only used to check structural invariants
450+
(void)to_plus_expr(expr);
449451
if(!is_number(expr.type()) &&
450452
expr.type().id()!=ID_pointer)
451453
return true;
@@ -454,8 +456,6 @@ bool simplify_exprt::simplify_plus(exprt &expr)
454456

455457
exprt::operandst &operands=expr.operands();
456458

457-
assert(expr.id()==ID_plus);
458-
459459
// floating-point addition is _NOT_ associative; thus,
460460
// there is special case for float
461461

0 commit comments

Comments
 (0)