File tree 4 files changed +24
-6
lines changed
4 files changed +24
-6
lines changed Original file line number Diff line number Diff line change 11
11
#include < cassert>
12
12
13
13
#include < util/arith_tools.h>
14
+ #include < util/expr_util.h>
14
15
#include < util/std_expr.h>
15
16
#include < util/byte_operators.h>
16
17
#include < util/endianness_map.h>
@@ -39,8 +40,12 @@ bvt boolbvt::convert_byte_extract(const byte_extract_exprt &expr)
39
40
if (expr.operands ().size ()!=2 )
40
41
throw " byte_extract takes two operands" ;
41
42
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))
44
49
{
45
50
exprt tmp = lower_byte_extract (expr, ns);
46
51
return convert_bv (tmp);
Original file line number Diff line number Diff line change 8
8
9
9
#include " boolbv.h"
10
10
11
- #include < iostream>
12
11
#include < cassert>
13
12
14
13
#include < util/arith_tools.h>
15
14
#include < util/byte_operators.h>
16
15
#include < util/endianness_map.h>
16
+ #include < util/expr_util.h>
17
+
18
+ #include < solvers/lowering/expr_lowering.h>
17
19
18
20
bvt boolbvt::convert_byte_update (const byte_update_exprt &expr)
19
21
{
20
22
if (expr.operands ().size ()!=3 )
21
23
throw " byte_update takes three operands" ;
22
24
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
+
23
35
const exprt &op=expr.op0 ();
24
36
const exprt &offset_expr=expr.offset ();
25
37
const exprt &value=expr.value ();
Original file line number Diff line number Diff line change @@ -878,9 +878,7 @@ static exprt lower_byte_update(
878
878
}
879
879
}
880
880
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)
884
882
{
885
883
return lower_byte_update (src, ns, false );
886
884
}
Original file line number Diff line number Diff line change @@ -12,11 +12,14 @@ Author: Michael Tautschnig
12
12
#include < util/expr.h>
13
13
14
14
class byte_extract_exprt ;
15
+ class byte_update_exprt ;
15
16
class namespacet ;
16
17
class popcount_exprt ;
17
18
18
19
exprt lower_byte_extract (const byte_extract_exprt &src, const namespacet &ns);
19
20
21
+ exprt lower_byte_update (const byte_update_exprt &src, const namespacet &ns);
22
+
20
23
exprt lower_byte_operators (const exprt &src, const namespacet &ns);
21
24
22
25
bool has_byte_operator (const exprt &src);
You can’t perform that action at this time.
0 commit comments