Skip to content

Smowton/fix/type equality improvements #4173

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
Show file tree
Hide file tree
Changes from 3 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
5 changes: 2 additions & 3 deletions src/goto-programs/link_goto_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,12 @@ static bool link_functions(
const irep_idt &id = to_symbol_expr(symbol.value).get_identifier();

#if 0
if(!base_type_eq(symbol.type, ns.lookup(id).type, ns))
if(symbol.type != ns.lookup(id).type)
{
std::cerr << symbol << '\n';
std::cerr << ns.lookup(id) << '\n';
}
INVARIANT(base_type_eq(symbol.type, ns.lookup(id).type, ns),
"type matches");
INVARIANT(symbol.type == ns.lookup(id).type, "type matches");
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say you can just remove this code.


macro_application.insert_expr(symbol.name, id);
Expand Down
4 changes: 2 additions & 2 deletions src/pointer-analysis/value_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1156,10 +1156,10 @@ void value_sett::assign(
}
else
{
if(rhs.type() != type)
if(rhs.type() != lhs.type())
throw "value_sett::assign type mismatch: "
"rhs.type():\n"+rhs.type().pretty()+"\n"+
"type:\n"+type.pretty();
"lhs.type():\n"+lhs.type().pretty();

rhs_member=make_member(rhs, name, ns);

Expand Down
4 changes: 2 additions & 2 deletions src/solvers/flattening/boolbv_equality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Author: Daniel Kroening, [email protected]

literalt boolbvt::convert_equality(const equal_exprt &expr)
{
const bool is_base_type_eq = expr.lhs().type() == expr.rhs().type();
const bool equality_types_match = expr.lhs().type() == expr.rhs().type();
DATA_INVARIANT_WITH_DIAGNOSTICS(
is_base_type_eq,
equality_types_match,
"types of expressions on each side of equality should match",
irep_pretty_diagnosticst{expr.lhs()},
irep_pretty_diagnosticst{expr.rhs()});
Expand Down