Skip to content

Commit 32a5f76

Browse files
committed
Do not unnecessary follow tag types when storing the boolbv mapping
Types in equations must match exactly, there is no need to follow tags when checking for type consistency. Also, do not use a followed type when storing the mapping. When retrieving a mapped value, assert type consistency.
1 parent 9fd5e8e commit 32a5f76

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/solvers/flattening/boolbv.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -573,11 +573,11 @@ bool boolbvt::boolbv_set_equality_to_true(const equal_exprt &expr)
573573
if(!equality_propagation)
574574
return true;
575575

576-
const typet &type=ns.follow(expr.lhs().type());
576+
const typet &type = expr.lhs().type();
577577

578-
if(expr.lhs().id()==ID_symbol &&
579-
type==ns.follow(expr.rhs().type()) &&
580-
type.id()!=ID_bool)
578+
if(
579+
expr.lhs().id() == ID_symbol && type == expr.rhs().type() &&
580+
type.id() != ID_bool)
581581
{
582582
// see if it is an unbounded array
583583
if(is_unbounded_array(type))

src/solvers/flattening/boolbv_get.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ exprt boolbvt::get(const exprt &expr) const
3131
if(it!=map.mapping.end())
3232
{
3333
const boolbv_mapt::map_entryt &map_entry=it->second;
34+
// an input expression must either be untyped (this is used for obtaining
35+
// the value of clock symbols, which do not have a fixed type as the clock
36+
// type is computed during symbolic execution) or match the type stored in
37+
// the mapping
38+
PRECONDITION(expr.type() == typet() || expr.type() == map_entry.type);
3439

3540
if(is_unbounded_array(map_entry.type))
3641
return bv_get_unbounded_array(expr);

0 commit comments

Comments
 (0)