aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2022-10-15 03:31:17 -0400
committerAndrew Kelley <andrew@ziglang.org>2022-10-15 14:19:40 -0400
commitf9192adaba0eb344ed12aad9c675cd73b740d2a2 (patch)
treef06afc534fa97ca50c1e8d56189d5697d160b095 /src/codegen/llvm.zig
parentc7f98332383d71a57699426027e82c435e91addc (diff)
downloadzig-f9192adaba0eb344ed12aad9c675cd73b740d2a2.tar.gz
zig-f9192adaba0eb344ed12aad9c675cd73b740d2a2.zip
llvm: fix lowering of non-byte-aligned field pointers
* When a field starts at some bit offset within a byte you need to load starting from that byte and shift, not starting from the next byte, so a rounded-down divide is required here, not a rounded-up one. * Remove paragraph from doc that no longer relates to anything. Closes #12363
Diffstat (limited to 'src/codegen/llvm.zig')
-rw-r--r--src/codegen/llvm.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 3a02cd630b..cc18109270 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -3943,7 +3943,7 @@ pub const DeclGen = struct {
}
break :b b;
};
- const byte_offset = llvm_usize.constInt((prev_bits + 7) / 8, .False);
+ const byte_offset = llvm_usize.constInt(prev_bits / 8, .False);
const field_addr = base_addr.constAdd(byte_offset);
bitcast_needed = false;
const final_llvm_ty = (try dg.lowerType(ptr_child_ty)).pointerType(0);