WebAssembly / WebAssembly/wabt
Wrong type error when validating globals with gc proposal features
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 8.1k
- Forks
- 827
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 18
Description
In the GC proposal, it allows using previous global value as an initializer expression.
Therefore, following wasm module is a valid module in the GC proposal.
;; global.wat
(module (global i32 (i32.const 0)) (global i32 (global.get 0)))
I run the module with the reference interpreter in the gc proposal, and it passes the validation.
$ gc/interperter/wasm global.wat
// terminates normally
As the reference interpreter also includes function references and tail call proposals, I enable all of them and run wat2wasm, but it raises type error.
$ wabt/bin/wat2wasm --enable-function-references --enable-tail-call --enable-gc global.wat
global.wat:1:60: error: initializer expression can only reference an imported global
(module (global i32 (i32.const 0)) (global i32 (global.get 0)))
^
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 issue with wat2wasm using global.wat and the --enable-function-references, --enable-tail-call, and --enable-gc flags. Trace the validation path for global initializer expressions and confirm that the valid module is accepted while invalid initializers remain rejected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100