Skip to content

fix accesses to exprt::opX() in ansi-c/ #4983

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 2 commits into from
Aug 6, 2019
Merged
Show file tree
Hide file tree
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
6 changes: 2 additions & 4 deletions src/ansi-c/ansi_c_convert_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ void ansi_c_convert_typet::read_rec(const typet &type)
{
const exprt &as_expr=
static_cast<const exprt &>(static_cast<const irept &>(type));
assert(as_expr.operands().size()==1);
msc_based=as_expr.op0();
msc_based = to_unary_expr(as_expr).op();
}
else if(type.id()==ID_custom_bv)
{
Expand Down Expand Up @@ -215,9 +214,8 @@ void ansi_c_convert_typet::read_rec(const typet &type)
c_storage_spec.is_thread_local=true;
else if(id=="align")
{
assert(it->operands().size()==1);
aligned=true;
alignment=it->op0();
alignment = to_unary_expr(*it).op();
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/ansi-c/ansi_c_language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ bool ansi_c_languaget::to_expr(
if(expr.id()==ID_typecast &&
expr.type().id()==ID_empty &&
expr.operands().size()==1)
expr=expr.op0();
{
expr = to_typecast_expr(expr).op();
}

return result;
}
Expand Down
6 changes: 3 additions & 3 deletions src/ansi-c/c_typecheck_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,9 +627,9 @@ void c_typecheck_baset::typecheck_declaration(
{
if(declaration.get_is_static_assert())
{
assert(declaration.operands().size()==2);
typecheck_expr(declaration.op0());
typecheck_expr(declaration.op1());
auto &static_assert_expr = to_binary_expr(declaration);
typecheck_expr(static_assert_expr.op0());
typecheck_expr(static_assert_expr.op1());
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/ansi-c/c_typecheck_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class c_typecheck_baset:
virtual void typecheck_expr_ptrmember(exprt &expr);
virtual void typecheck_expr_rel(binary_relation_exprt &expr);
virtual void typecheck_expr_rel_vector(binary_relation_exprt &expr);
virtual void adjust_float_rel(exprt &expr);
virtual void adjust_float_rel(binary_relation_exprt &);
static void add_rounding_mode(exprt &);
virtual void typecheck_expr_index(exprt &expr);
virtual void typecheck_expr_typecast(exprt &expr);
Expand Down
4 changes: 1 addition & 3 deletions src/ansi-c/c_typecheck_code.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,9 +567,7 @@ void c_typecheck_baset::typecheck_gcc_computed_goto(codet &code)
throw 0;
}

assert(dest.operands().size()==1);

typecheck_expr(dest.op0());
typecheck_expr(to_unary_expr(dest).op());
dest.type() = void_type();
}

Expand Down
Loading