Skip to content

with_exprt need only have an odd number of operands [blocks: #2068] #4059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/util/std_expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -3445,8 +3445,8 @@ inline const with_exprt &to_with_expr(const exprt &expr)
{
PRECONDITION(expr.id()==ID_with);
DATA_INVARIANT(
expr.operands().size()==3,
"Array/structure update must have three operands");
expr.operands().size() >= 3 && expr.operands().size() % 2 == 1,
"array/structure update must have at least three operands");
return static_cast<const with_exprt &>(expr);
}

Expand All @@ -3455,8 +3455,8 @@ inline with_exprt &to_with_expr(exprt &expr)
{
PRECONDITION(expr.id()==ID_with);
DATA_INVARIANT(
expr.operands().size()==3,
"Array/structure update must have three operands");
expr.operands().size() >= 3 && expr.operands().size() % 2 == 1,
"array/structure update must have at least three operands");
return static_cast<with_exprt &>(expr);
}

Expand All @@ -3466,10 +3466,9 @@ template<> inline bool can_cast_expr<with_exprt>(const exprt &base)
}
inline void validate_expr(const with_exprt &value)
{
validate_operands(
value,
3,
"Array/structure update must have three operands");
DATA_INVARIANT(
value.operands().size() % 2 == 1,
"array/structure update must have an odd number of operands");
}

class index_designatort : public expr_protectedt
Expand Down