bytecodealliance / bytecodealliance/wasmtime
Cranelift: Incorrect bitcast result in `interpret` backend: return value overwritten
- Dominant language
- Rust
- Stars
- 18.6k
- Forks
- 1.8k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 126
Description
### `.clif` Test Case
```
test optimize
set opt_level=none
set preserve_frame_pointers=true
set enable_multi_ret_implicit_sret=true
function %main() -> i16, i16x8, i32x4 fast {
const0 = 0xc07a84a9c07a84a9c07a84a9c07a84a9
block0:
v3 = iconst.i16 -24145
v5 = iconst.i64 0x41de_6f84_61b3_a1af
v6 = uextend.i128 v5
v7 = bitcast.i16x8 little v6
v11 = vconst.i32x4 const0
return v3, v7, v11
}
; print: %main()
```
### Steps to Reproduce
Execute using `run` and `interpret` respectively.
```
$ clif-util run -v test1.clif
$ clif-util interpret -v test1.clif
```
### Results
```
$ clif-util run -v test1.clif
%main() -> [-24145, 0x000000000000000041de6f8461b3a1af, 0xc07a84a9c07a84a9c07a84a9c07a84a9]
test1.clif
1 file
```
```
$ clif-util interpret -v test1.clif
%main() -> [-24145, -24145, 0xc07a84a9c07a84a9c07a84a9c07a84a9]
test1.clif
1 file
```
Clearly, under the `interpret` command, the return variable `v7` incorrectly returns the value of `v3`.
### Versions and Environment
Operating system: Ubuntu 22.04
Architecture: x86_64
Contributor guide
Assessment
This issue has not been assessed yet.