aboutsummaryrefslogtreecommitdiff
path: root/lib/std/math.zig
diff options
context:
space:
mode:
authorLuuk de Gram <luuk@degram.dev>2023-07-04 20:12:48 +0200
committerLuuk de Gram <luuk@degram.dev>2023-07-08 17:45:05 +0200
commitd54ebf4356eaeeab4d256d0da4f81678226f81a6 (patch)
tree69129636312bc7c8fa02db2ad63f7cbaa74e1959 /lib/std/math.zig
parent836f9fceab03c7de56eba7a9c2e810206e7e8469 (diff)
downloadzig-d54ebf4356eaeeab4d256d0da4f81678226f81a6.tar.gz
zig-d54ebf4356eaeeab4d256d0da4f81678226f81a6.zip
llvm: add safety-check for Wasm memset
When lowering the `memset` instruction, LLVM will lower it to WebAssembly's `memory.fill` instruction when the bulk-memory feature is enabled. This instruction will trap when the destination address is out-of-bounds. By Zig's semantics, it is valid to have an invalid pointer when the length is 0. To prevent runtimes from trapping, we add a safety-check for slices to only lower to a memset instruction when the length is larger than 0.
Diffstat (limited to 'lib/std/math.zig')
0 files changed, 0 insertions, 0 deletions