mirror of
https://github.com/ziglang/zig.git
synced 2025-12-14 10:13:07 +00:00
wasm: memset - correctly load the ptr for slices
Previously we would use the address of the slice itself, which would result in miscompilations and accidently setting the memory region of the slice itself, rather than based on the `ptr` field.
This commit is contained in:
parent
061d99285d
commit
b93fa9833e
@ -4464,7 +4464,9 @@ fn airMemset(func: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void
|
||||
.One => @as(WValue, .{ .imm32 = @intCast(u32, ptr_ty.childType().arrayLen()) }),
|
||||
.C, .Many => unreachable,
|
||||
};
|
||||
try func.memset(ptr, len, value);
|
||||
|
||||
const dst_ptr = try func.sliceOrArrayPtr(ptr, ptr_ty);
|
||||
try func.memset(dst_ptr, len, value);
|
||||
|
||||
func.finishAir(inst, .none, &.{ bin_op.lhs, bin_op.rhs });
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user