Stream: git-wasmtime

Topic: wasmtime / issue #11240 Cranelift: Incorrect bitcast resu...


view this post on Zulip Wasmtime GitHub notifications bot (Jul 15 2025 at 12:31):

akldc opened issue #11240:

.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

view this post on Zulip Wasmtime GitHub notifications bot (Jul 15 2025 at 12:31):

akldc added the bug label to Issue #11240.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 15 2025 at 12:31):

akldc added the cranelift label to Issue #11240.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 15 2025 at 14:23):

alexcrichton added the cranelift:area:interpreter label to Issue #11240.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 16 2025 at 22:48):

shashforge commented on issue #11240:

Hello maintainers,

If no one is currently working on this issue, I would be grateful for the opportunity to take it on. Please let me know. Thank you!

view this post on Zulip Wasmtime GitHub notifications bot (Jul 16 2025 at 22:49):

cfallin commented on issue #11240:

@shashforge yes, please feel free to work on this one!

view this post on Zulip Wasmtime GitHub notifications bot (Jul 23 2025 at 04:24):

tommyscholly commented on issue #11240:

I've been poking around this if that's fine by you @shashforge. I narrowed down the issue to how extractlanes works with Bitcasting on scalar values and have a solution that refactors extractlanes a bit to interpret a scalar values bits as the lanes.


Last updated: Dec 06 2025 at 06:05 UTC