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 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
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/goto-programs/string_abstraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ bool string_abstractiont::build_wrap(
// #define build_wrap(a,b,c) build(a,b,c)
// to avoid it
const typet &a_t=build_abstraction_type(object.type());
/*assert(type_eq(dest.type(), a_t, ns) ||
/*assert(dest.type() == a_t ||
(dest.type().id()==ID_array && a_t.id()==ID_pointer &&
type_eq(dest.type().subtype(), a_t.subtype(), ns)));
dest.type().subtype() == a_t.subtype()));
*/
if(
dest.type() != a_t &&
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
3 changes: 0 additions & 3 deletions src/util/simplify_expr_struct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,6 @@ bool simplify_exprt::simplify_member(exprt &expr)

// Guess: turning this into a byte-extract operation is not really an
// optimisation.
// The type_eq check is because get_subexpression_at_offset uses
// base_type_eq, whereas in the context of a simplifier we should not
// change the type of the expression.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'll note down a TODO on my end to remove that type equality check when enabling the simplifier type equality checks.

if(
equivalent_member.is_not_nil() &&
equivalent_member.id() != ID_byte_extract_little_endian &&
Expand Down