bytecodealliance / bytecodealliance/wasmtime

Missing contref handling in `VMArrayRef::read_elem`

Open
#13,021 0 comments 0 reactions 0 assignees View on GitHub
wasm-proposal:stack-switching
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 19h
Merged PRs (30d)
121

Description

The `contref` top type isn't [handled here](https://github.com/bytecodealliance/wasmtime/blob/3aab955b3e9dc2fcfa37df26af38e0804ca48edf/crates/wasmtime/src/runtime/vm/gc/enabled/arrayref.rs#L182). Wanted to file a tracking issue for this.

For example this test:

```wasm
(module
(type $ft (func))
(type $ct (cont $ft))
(type $arr (array (mut (ref null $ct))))
(func (export "boom")
(local $a (ref $arr))
(local.set $a (array.new_default $arr (i32.const 2)))
(array.copy $arr $arr
(local.get $a) (i32.const 0)
(local.get $a) (i32.const 0)
(i32.const 1))
)
)
(invoke "boom")
```

fails as:

```
$ wasmtime wast testcase.wast -W stack-switching,function-references,gc -C collector=null

thread 'main' (402739) panicked at crates/wasmtime/src/runtime/vm/gc/enabled/arrayref.rs:182:30:
internal error: entered unreachable code: not a top type: Cont
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
zsh: IOT instruction (core dumped) wasmtime wast testcase.wast -W stack-switching,function-references,gc -C
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.