Keep -sanitize:address happy with bit_field loads

This commit is contained in:
gingerBill
2024-06-29 16:18:07 +01:00
parent ff2d042313
commit a935ade0d2

View File

@@ -791,6 +791,7 @@ gb_internal void lb_addr_store(lbProcedure *p, lbAddr addr, lbValue value) {
lb_emit_runtime_call(p, "__write_bits", args);
} else if ((addr.bitfield.bit_offset % 8) == 0 &&
(addr.bitfield.bit_size % 8) == 0) {
gb_printf_err("Here!\n");
lbValue src = lb_address_from_load_or_generate_local(p, value);
lbValue byte_offset = lb_const_int(p->module, t_uintptr, addr.bitfield.bit_offset/8);
@@ -1162,7 +1163,7 @@ gb_internal lbValue lb_addr_load(lbProcedure *p, lbAddr const &addr) {
lbValue copy_size = byte_size;
lbValue src_offset = lb_emit_conv(p, src, t_u8_ptr);
src_offset = lb_emit_ptr_offset(p, src_offset, byte_offset);
if (addr.bitfield.bit_offset + dst_byte_size <= total_bitfield_bit_size) {
if (addr.bitfield.bit_offset + 8*dst_byte_size <= total_bitfield_bit_size) {
do_mask = true;
copy_size = lb_const_int(p->module, t_uintptr, dst_byte_size);
}