aboutsummaryrefslogtreecommitdiff
path: root/src/arch/wasm/CodeGen.zig
diff options
context:
space:
mode:
authorXavier Bouchoux <xavierb@gmail.com>2023-10-03 05:34:19 +0000
committerXavier Bouchoux <xavierb@gmail.com>2023-10-03 05:34:19 +0000
commit405705cb76914072b9a91ac29f7cf0bf67b255f4 (patch)
tree2f2928e3a6c42626cf1464a2f52dba546ea6e50d /src/arch/wasm/CodeGen.zig
parent62d178e91af57c19d0ac000fe6930039a23e53a3 (diff)
downloadzig-405705cb76914072b9a91ac29f7cf0bf67b255f4.tar.gz
zig-405705cb76914072b9a91ac29f7cf0bf67b255f4.zip
codegen: fix byte-aligned field offsets in unaligned nested packed structs
Diffstat (limited to 'src/arch/wasm/CodeGen.zig')
-rw-r--r--src/arch/wasm/CodeGen.zig3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/arch/wasm/CodeGen.zig b/src/arch/wasm/CodeGen.zig
index 1fc28a8287..3d3054c618 100644
--- a/src/arch/wasm/CodeGen.zig
+++ b/src/arch/wasm/CodeGen.zig
@@ -3828,7 +3828,8 @@ fn structFieldPtr(
if (result_ty.ptrInfo(mod).packed_offset.host_size != 0) {
break :offset @as(u32, 0);
}
- break :offset struct_ty.packedStructFieldByteOffset(index, mod) + @divExact(struct_ptr_ty_info.packed_offset.bit_offset, 8);
+ const struct_type = mod.typeToStruct(struct_ty).?;
+ break :offset @divExact(mod.structPackedFieldBitOffset(struct_type, index) + struct_ptr_ty_info.packed_offset.bit_offset, 8);
},
.Union => 0,
else => unreachable,