zero_bits_offset returns zero if addresses observed
MODIFY
ir/memory.cpp
ir/memory.cpp
@@ -16,9 +16,15 @@ using namespace util;
static unsigned ptr_next_idx = 0;
+static bool observes_addresses() {
+ return IR::has_ptr2int || IR::has_int2ptr;
+}
+
static unsigned zero_bits_offset() {
assert(is_power2(bits_byte));
- return ilog2(bits_byte / 8);
+ // If an address is observed, bits_bytes is not necessarily related with
+ // offsets.
+ return observes_addresses() ? 0 : ilog2(bits_byte / 8);
}
static bool byte_has_ptr_bit() {
@@ -332,10 +338,6 @@ static StateValue bytesToValue(const Memory &m, const vector<Byte> &bytes,
}
}
-static bool observes_addresses() {
- return IR::has_ptr2int || IR::has_int2ptr;
-}
-
static bool ptr_has_local_bit() {
return (num_locals_src || num_locals_tgt) && num_nonlocals;
}

zero_bits_offset returns zero if addresses observed (#431)