@@ -59,6 +59,7 @@ struct expr_to_smt_conversion_test_environmentt
59
59
60
60
smt_object_mapt object_map;
61
61
smt_object_sizet object_size_function;
62
+ smt_is_dynamic_objectt is_dynamic_object_function;
62
63
type_size_mapt pointer_sizes;
63
64
64
65
private:
@@ -94,7 +95,8 @@ expr_to_smt_conversion_test_environmentt::convert(const exprt &expression) const
94
95
expression,
95
96
object_map,
96
97
pointer_sizes,
97
- object_size_function.make_application );
98
+ object_size_function.make_application ,
99
+ is_dynamic_object_function.make_application );
98
100
}
99
101
100
102
TEST_CASE (" \" array_typet\" to smt sort conversion" , " [core][smt2_incremental]" )
@@ -471,7 +473,8 @@ TEST_CASE(
471
473
ns,
472
474
test.pointer_sizes ,
473
475
test.object_map ,
474
- test.object_size_function .make_application );
476
+ test.object_size_function .make_application ,
477
+ test.is_dynamic_object_function .make_application );
475
478
476
479
INFO (" Input expr: " + pointer_arith_expr.pretty (2 , 0 ));
477
480
const auto constructed_term = test.convert (pointer_arith_expr);
@@ -546,7 +549,8 @@ TEST_CASE(
546
549
ns,
547
550
test.pointer_sizes ,
548
551
test.object_map ,
549
- test.object_size_function .make_application );
552
+ test.object_size_function .make_application ,
553
+ test.is_dynamic_object_function .make_application );
550
554
551
555
INFO (" Input expr: " + pointer_arith_expr.pretty (2 , 0 ));
552
556
const auto constructed_term = test.convert (pointer_arith_expr);
@@ -577,7 +581,8 @@ TEST_CASE(
577
581
ns,
578
582
test.pointer_sizes ,
579
583
test.object_map ,
580
- test.object_size_function .make_application );
584
+ test.object_size_function .make_application ,
585
+ test.is_dynamic_object_function .make_application );
581
586
INFO (" Input expr: " + pointer_arith_expr.pretty (2 , 0 ));
582
587
const auto constructed_term = test.convert (pointer_arith_expr);
583
588
const auto expected_term = smt_bit_vector_theoryt::subtract (
@@ -614,7 +619,8 @@ TEST_CASE(
614
619
ns,
615
620
test.pointer_sizes ,
616
621
test.object_map ,
617
- test.object_size_function .make_application );
622
+ test.object_size_function .make_application ,
623
+ test.is_dynamic_object_function .make_application );
618
624
INFO (" Input expr: " + pointer_subtraction.pretty (2 , 0 ));
619
625
const auto constructed_term = test.convert (pointer_subtraction);
620
626
const auto expected_term = smt_bit_vector_theoryt::signed_divide (
@@ -1673,6 +1679,30 @@ TEST_CASE(
1673
1679
smt_bit_vector_theoryt::concat (object, offset))}));
1674
1680
}
1675
1681
1682
+ TEST_CASE (
1683
+ " expr to smt conversion for is_dynamic_object expressions" ,
1684
+ " [core][smt2_incremental]" )
1685
+ {
1686
+ auto test =
1687
+ expr_to_smt_conversion_test_environmentt::make (test_archt::x86_64);
1688
+ const symbol_tablet symbol_table;
1689
+ const namespacet ns{symbol_table};
1690
+ const symbol_exprt foo{" foo" , unsignedbv_typet{32 }};
1691
+ const is_dynamic_object_exprt is_dynamic_object{address_of_exprt{foo}};
1692
+ track_expression_objects (is_dynamic_object, ns, test.object_map );
1693
+ const auto foo_id = 2 ;
1694
+ CHECK (test.object_map .at (foo).unique_id == foo_id);
1695
+ const auto object_bits = config.bv_encoding .object_bits ;
1696
+ const auto object = smt_bit_vector_constant_termt{foo_id, object_bits};
1697
+ const auto offset = smt_bit_vector_constant_termt{0 , 64 - object_bits};
1698
+ INFO (" Expression " + is_dynamic_object.pretty (1 , 0 ));
1699
+ CHECK (
1700
+ test.convert (is_dynamic_object) ==
1701
+ test.is_dynamic_object_function .make_application (std::vector<smt_termt>{
1702
+ smt_bit_vector_theoryt::extract (63 , 64 - object_bits)(
1703
+ smt_bit_vector_theoryt::concat (object, offset))}));
1704
+ }
1705
+
1676
1706
TEST_CASE (
1677
1707
" lower_address_of_array_index works correctly" ,
1678
1708
" [core][smt2_incremental]" )
@@ -1718,7 +1748,8 @@ TEST_CASE(
1718
1748
ns,
1719
1749
test.pointer_sizes ,
1720
1750
test.object_map ,
1721
- test.object_size_function .make_application );
1751
+ test.object_size_function .make_application ,
1752
+ test.is_dynamic_object_function .make_application );
1722
1753
const smt_termt expected = smt_core_theoryt::equal (
1723
1754
smt_identifier_termt (symbol.get_identifier (), smt_bit_vector_sortt{64 }),
1724
1755
smt_bit_vector_theoryt::add (
0 commit comments