zig
zig copied to clipboard
Cannot use WebAssembly 64-bit atomics
Zig Version
0.12.0
Steps to Reproduce and Observed Behavior
When trying to compile the following program:
pub export fn setTwelve(ptr: *i64) void {
@atomicStore(i64, ptr, 12, .monotonic);
}
Using the following command:
zig build-obj --name output -fno-emit-bin -femit-asm=output.s -target wasm32-freestanding -mcpu baseline+atomics example.zig
The compiler returns the following error:
example.zig:2:18: error: expected 32-bit integer type or smaller; found 64-bit integer type
Expected Behavior
The compiler should be able to use WebAssembly's 64-bit atomics whenever the atomics cpu feature is enabled.
To use the 64-bit atomics, you need to use wasm64.
But the instructions exists for wasm32, why the wasm64 requirement?
It shouldn't be required.