Skip to content

Commit 3bb45cb

Browse files
committed
Avoid undefined shift
1 parent ddbc14b commit 3bb45cb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/cprover/bv_pointers_wide.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -850,14 +850,16 @@ bvt bv_pointers_widet::add_addr(const exprt &expr)
850850

851851
const pointer_typet type = pointer_type(expr.type());
852852
const std::size_t object_bits = get_object_width(type);
853-
const std::size_t max_objects = std::size_t(1) << object_bits;
853+
const mp_integer max_objects = power(2, object_bits);
854854

855-
if(a == max_objects)
855+
if(a >= max_objects)
856+
{
856857
throw analysis_exceptiont(
857858
"too many addressed objects: maximum number of objects is set to 2^n=" +
858-
std::to_string(max_objects) + " (with n=" + std::to_string(object_bits) +
859+
integer2string(max_objects) + " (with n=" + std::to_string(object_bits) +
859860
"); " +
860861
"use the `--object-bits n` option to increase the maximum number");
862+
}
861863

862864
return encode(a, type);
863865
}

0 commit comments

Comments
 (0)