| 135 | } |
| 136 | |
| 137 | expr Pointer::mkUndef(State &s) { |
| 138 | auto &m = s.getMemory(); |
| 139 | bool force_local = false, force_nonlocal = false; |
| 140 | if (hasLocalBit()) { |
| 141 | force_nonlocal = m.numLocals() == 0; |
| 142 | force_local = !force_nonlocal && m.numNonlocals() == 0; |
| 143 | } |
| 144 | |
| 145 | unsigned bits_phy = hasLogicalBit() * bits_ptr_address; |
| 146 | unsigned bits_log |
| 147 | = bits_for_bid + bits_for_offset - (force_local | force_nonlocal); |
| 148 | unsigned var_bits = hasLogicalBit() + max(bits_log, bits_phy); |
| 149 | |
| 150 | expr var = expr::mkFreshVar("undef", expr::mkUInt(0, var_bits)); |
| 151 | |
| 152 | expr ptr; |
| 153 | if (bits_log >= bits_phy) { |
| 154 | ptr = var.trunc(bits_log); |
| 155 | if (force_local || force_nonlocal) |
| 156 | ptr = mkLongBid(ptr, force_local); |
| 157 | if (hasLogicalBit()) |
| 158 | ptr = var.sign().concat(ptr); |
| 159 | } else { |
| 160 | ptr = var; |
| 161 | } |
| 162 | |
| 163 | ptr = ptr.concat_zeros(bits_for_ptrattrs); |
| 164 | |
| 165 | s.addUndefVar(std::move(var)); |
| 166 | assert(ptr.bits() == totalBits()); |
| 167 | return ptr; |
| 168 | } |
| 169 | |
| 170 | unsigned Pointer::totalBits() { |
| 171 | return max(total_bits_logical(), total_bits_physical()); |
nothing calls this directly
no test coverage detected