WebAssembly / WebAssembly/binaryen
wasm2js does not support 64-bit memories
Open
Nobody has claimed this yet.
- Dominant language
- WebAssembly
- Stars
- 8.6k
- Forks
- 885
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 69
Description
For C++ source code,
extern "C" int add (int first, int second)
{
return first + second;
}
Compiling with clang-15 with wasm64 target,
clang --target=wasm64 --no-standard-libraries -Wl,--export-all -Wl,--no-entry -o add.wasm add.cc
And translate to js using wasm2js,
wasm2js add.wasm
However it fails with
[PassRunner] running pass: i64-to-i32-lowering... 0.0005889 seconds. [PassRunner] (validating) [PassRunner] running nested passes [PassRunner] running pass: ... 0.0002939 seconds. [PassRunner] nested passes took 0.0002939 seconds.
[wasm-validator error in function add] i32 != i64: store pointer must match memory index type, on
(i32.store offset=12
(block (result i32)
(local.set $40
(local.get $20)
)
(local.get $19)
)
(local.get $21)
)
[wasm-validator error in function add] i32 != i64: store pointer must match memory index type, on
(i32.store offset=8
(block (result i32)
(local.set $37
(local.get $23)
)
(local.get $22)
) (local.get $24) )
[wasm-validator error in function add] i32 != i64: load pointer type must match memory index type, on
(i32.load offset=12
(block (result i32)
(local.set $35
(local.get $26)
)
(local.get $25)
)
)
[wasm-validator error in function add] i32 != i64: load pointer type must match memory index type, on
(i32.load offset=8
(block (result i32)
(local.set $38
(local.get $29)
)
(local.get $28)
)
)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the shown clang --target=wasm64 command and wasm2js on add.wasm. Start by tracing the i64-to-i32-lowering pass and its validation output; done means the wasm64 input translates without load/store pointer type validation errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, wasm
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100