Skip to content

Commit fabc2a1

Browse files
committed
Back-end support for {r,w,rw}_ok and pointer_in_range
There is no longer a need to rewrite these early on during program instrumentation. Instead, let the back-end handle them. For now, they are just handled by lowering the expressions. We may, in future, decide to have back-end specific (and possibly more efficient) handling of these.
1 parent ad95c7b commit fabc2a1

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/solvers/flattening/bv_pointers.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Author: Daniel Kroening, [email protected]
1818
#include <util/pointer_expr.h>
1919
#include <util/pointer_offset_size.h>
2020
#include <util/pointer_predicates.h>
21+
#include <util/simplify_expr.h>
2122

2223
/// Map bytes according to the configured endianness. The key difference to
2324
/// endianness_mapt is that bv_endianness_mapt is aware of the bit-level
@@ -203,6 +204,10 @@ literalt bv_pointerst::convert_rest(const exprt &expr)
203204
bv_utilst::representationt::SIGNED));
204205
}
205206
}
207+
else if(expr.id() == ID_r_ok || expr.id() == ID_w_ok || expr.id() == ID_rw_ok)
208+
return convert(simplify_expr(to_r_or_w_ok_expr(expr).lower(ns), ns));
209+
else if(expr.id() == ID_pointer_in_range)
210+
return convert(simplify_expr(to_pointer_in_range_expr(expr).lower(ns), ns));
206211

207212
return SUB::convert_rest(expr);
208213
}

src/solvers/smt2/smt2_conv.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2499,6 +2499,14 @@ void smt2_convt::convert_expr(const exprt &expr)
24992499
out << ')';
25002500
}
25012501
}
2502+
else if(expr.id() == ID_r_ok || expr.id() == ID_w_ok || expr.id() == ID_rw_ok)
2503+
{
2504+
convert_expr(simplify_expr(to_r_or_w_ok_expr(expr).lower(ns), ns));
2505+
}
2506+
else if(expr.id() == ID_pointer_in_range)
2507+
{
2508+
convert_expr(simplify_expr(to_pointer_in_range_expr(expr).lower(ns), ns));
2509+
}
25022510
else
25032511
INVARIANT_WITH_DIAGNOSTICS(
25042512
false,

0 commit comments

Comments
 (0)