@@ -68,6 +68,16 @@ TEST_CASE("Value expr construction from smt.", "[core][smt2_incremental]")
6868 rowt{smt_bool_literal_termt{false }, false_exprt{}},
6969 rowt{smt_bit_vector_constant_termt{0 , 8 }, from_integer (0 , c_bool_typet (8 ))},
7070 rowt{smt_bit_vector_constant_termt{1 , 8 }, from_integer (1 , c_bool_typet (8 ))},
71+ rowt{
72+ smt_bit_vector_constant_termt{0 , 64 },
73+ from_integer (0 , pointer_typet (void_type (), 64 /* bits */ ))},
74+ // The reason for the more intricate elaboration of a pointer with a value
75+ // of 12 is a limitation in the design of from_integer, which only handles
76+ // pointers with value 0 (null pointers).
77+ rowt{
78+ smt_bit_vector_constant_termt{12 , 64 },
79+ constant_exprt (
80+ integer2bvrep (12 , 64 ), pointer_typet (void_type (), 64 /* bits */ ))},
7181 UNSIGNED_BIT_VECTOR_TESTS (8 ),
7282 SIGNED_BIT_VECTOR_TESTS (8 ),
7383 UNSIGNED_BIT_VECTOR_TESTS (16 ),
@@ -96,23 +106,31 @@ TEST_CASE(
96106
97107 using rowt = std::tuple<smt_termt, typet, std::string>;
98108 std::tie (input_term, input_type, invariant_reason) = GENERATE (
99- rowt{smt_bool_literal_termt{true },
100- unsignedbv_typet{16 },
101- " Bool terms may only be used to construct bool typed expressions." },
102- rowt{smt_identifier_termt{" foo" , smt_bit_vector_sortt{16 }},
103- unsignedbv_typet{16 },
104- " Unexpected conversion of identifier to value expression." },
109+ rowt{
110+ smt_bool_literal_termt{true },
111+ unsignedbv_typet{16 },
112+ " Bool terms may only be used to construct bool typed expressions." },
113+ rowt{
114+ smt_identifier_termt{" foo" , smt_bit_vector_sortt{16 }},
115+ unsignedbv_typet{16 },
116+ " Unexpected conversion of identifier to value expression." },
105117 rowt{
106118 smt_bit_vector_constant_termt{0 , 8 },
107119 unsignedbv_typet{16 },
108120 " Width of smt bit vector term must match the width of bit vector type." },
109- rowt{smt_bit_vector_constant_termt{0 , 8 },
110- empty_typet{},
111- " construct_value_expr_from_smt for bit vector should not be applied "
112- " to unsupported type empty" },
113- rowt{smt_core_theoryt::make_not (smt_bool_literal_termt{true }),
114- unsignedbv_typet{16 },
115- " Unexpected conversion of function application to value expression." });
121+ rowt{
122+ smt_bit_vector_constant_termt{0 , 8 },
123+ empty_typet{},
124+ " construct_value_expr_from_smt for bit vector should not be applied "
125+ " to unsupported type empty" },
126+ rowt{
127+ smt_core_theoryt::make_not (smt_bool_literal_termt{true }),
128+ unsignedbv_typet{16 },
129+ " Unexpected conversion of function application to value expression." },
130+ rowt{
131+ smt_bit_vector_constant_termt{0 , 16 },
132+ pointer_typet{unsigned_int_type (), 0 },
133+ " Width of smt bit vector term must match the width of pointer type" });
116134 SECTION (invariant_reason)
117135 {
118136 const cbmc_invariants_should_throwt invariants_throw;
0 commit comments