File tree Expand file tree Collapse file tree 4 files changed +24
-6
lines changed Expand file tree Collapse file tree 4 files changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ Author: Daniel Kroening, kroening@kroening.com
1111#include < cassert>
1212
1313#include < util/arith_tools.h>
14+ #include < util/expr_util.h>
1415#include < util/std_expr.h>
1516#include < util/byte_operators.h>
1617#include < util/endianness_map.h>
@@ -39,8 +40,12 @@ bvt boolbvt::convert_byte_extract(const byte_extract_exprt &expr)
3940 if (expr.operands ().size ()!=2 )
4041 throw " byte_extract takes two operands" ;
4142
42- // if we extract from an unbounded array, call the flattening code
43- if (is_unbounded_array (expr.op ().type ()))
43+ // if we extract from an unbounded array or a data type that
44+ // includes pointers, call the flattening code
45+ if (
46+ is_unbounded_array (expr.op ().type ()) ||
47+ has_subtype (expr.type (), ID_pointer, ns) ||
48+ has_subtype (expr.op ().type (), ID_pointer, ns))
4449 {
4550 exprt tmp = lower_byte_extract (expr, ns);
4651 return convert_bv (tmp);
Original file line number Diff line number Diff line change @@ -8,18 +8,30 @@ Author: Daniel Kroening, kroening@kroening.com
88
99#include " boolbv.h"
1010
11- #include < iostream>
1211#include < cassert>
1312
1413#include < util/arith_tools.h>
1514#include < util/byte_operators.h>
1615#include < util/endianness_map.h>
16+ #include < util/expr_util.h>
17+
18+ #include < solvers/lowering/expr_lowering.h>
1719
1820bvt boolbvt::convert_byte_update (const byte_update_exprt &expr)
1921{
2022 if (expr.operands ().size ()!=3 )
2123 throw " byte_update takes three operands" ;
2224
25+ // if we update an unbounded array or a data type that
26+ // includes pointers, call the flattening code
27+ if (
28+ is_unbounded_array (expr.op ().type ()) ||
29+ has_subtype (expr.value ().type (), ID_pointer, ns) ||
30+ has_subtype (expr.op0 ().type (), ID_pointer, ns))
31+ {
32+ return convert_bv (lower_byte_update (expr, ns));
33+ }
34+
2335 const exprt &op=expr.op0 ();
2436 const exprt &offset_expr=expr.offset ();
2537 const exprt &value=expr.value ();
Original file line number Diff line number Diff line change @@ -878,9 +878,7 @@ static exprt lower_byte_update(
878878 }
879879}
880880
881- static exprt lower_byte_update (
882- const byte_update_exprt &src,
883- const namespacet &ns)
881+ exprt lower_byte_update (const byte_update_exprt &src, const namespacet &ns)
884882{
885883 return lower_byte_update (src, ns, false );
886884}
Original file line number Diff line number Diff line change @@ -12,11 +12,14 @@ Author: Michael Tautschnig
1212#include < util/expr.h>
1313
1414class byte_extract_exprt ;
15+ class byte_update_exprt ;
1516class namespacet ;
1617class popcount_exprt ;
1718
1819exprt lower_byte_extract (const byte_extract_exprt &src, const namespacet &ns);
1920
21+ exprt lower_byte_update (const byte_update_exprt &src, const namespacet &ns);
22+
2023exprt lower_byte_operators (const exprt &src, const namespacet &ns);
2124
2225bool has_byte_operator (const exprt &src);
You can’t perform that action at this time.
0 commit comments