Skip to content

Commit 4e426d3

Browse files
authored
Merge pull request #7842 from tautschnig/undefined-shift
Fix undefined shift on non-64-bit architectures
2 parents c811e73 + eda7976 commit 4e426d3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

unit/solvers/smt2_incremental/convert_expr_to_smt.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,11 @@ TEST_CASE(
246246
expr_to_smt_conversion_test_environmentt::make(test_archt::x86_64);
247247
const pointer_typet pointer_type = ::pointer_type(void_type());
248248
const std::size_t pointer_width = pointer_type.get_width();
249+
static_assert(
250+
sizeof(unsigned long long) >= 8,
251+
"unsigned long long must be 64bits or wider");
249252
const constant_exprt invalid_ptr{
250-
integer2bvrep(1ul << (pointer_width - object_bits), pointer_width),
253+
integer2bvrep(1ull << (pointer_width - object_bits), pointer_width),
251254
pointer_type};
252255
const is_invalid_pointer_exprt is_invalid_ptr{invalid_ptr};
253256
const smt_termt expected_smt_term = smt_core_theoryt::equal(

0 commit comments

Comments
 (0)