Stream: git-wasmtime

Topic: wasmtime / issue #15362 Cranelift: `try_call` with two co...


view this post on Zulip Wasmtime GitHub notifications bot (Nov 19 2026 at 00:18):

Benjins opened issue #15362:

.clif Test Case

test run
set regalloc_algorithm=single_pass
set enable_multi_ret_implicit_sret
target x86_64

function %callee() -> i64, i64, i64, i64, i64, i64, i64, i64, i64 {
block0:
    v0 = iconst.i64 1000
    v1 = iconst.i64 1001
    v2 = iconst.i64 1002
    v3 = iconst.i64 1003
    v4 = iconst.i64 1004
    v5 = iconst.i64 1005
    v6 = iconst.i64 1006
    v7 = iconst.i64 1007
    v8 = iconst.i64 1008
    return v0, v1, v2, v3, v4, v5, v6, v7, v8
}

function %caller() -> i64 {
    sig0 = () -> i64, i64, i64, i64, i64, i64, i64, i64, i64
    fn0 = %callee() -> i64, i64, i64, i64, i64, i64, i64, i64, i64
block0:
    try_call fn0(), sig0, block1(ret8, ret8), []
block1(v1: i64, v2: i64):
    return v2
}
; run: %caller() == 1008

Steps to Reproduce

Run the test case with cargo run -p cranelift-tools --bin clif-util -- test <path>

Expected Results

The test should pass: . It does pass with:

block1(v1: i64, v2: i64):
    return v1

even though v1 and v2 are given the same value from callee. It also passes without the set regalloc_algorithm=single_pass line.

Actual Results

[2026-11-18T23:46:46Z ERROR cranelift_filetests::concurrent] FAIL: run
FAIL bug_01.clif: run

Caused by:
    Failed test: run: %caller() == 1008, actual: 134149612526944
1 tests
Error: 1 failure

The actual value varies, it seems like a garbage read from something. Here's a subset of the disassembly for caller:

  21:   41 ff d7                callq   *%r15
  24:   4c 8b 1c 24             movq    (%rsp), %r11
  28:   4c 89 5c 24 48          movq    %r11, 0x48(%rsp)
  2d:   4c 8b 5c 24 08          movq    8(%rsp), %r11
  ; ... (nothing writes to 0x40(%rsp) but it's then read)
  69:   48 8b 44 24 40          movq    0x40(%rsp), %rax

Versions and Environment

Cranelift version or commit: 3ce2209872ccf1ea115914a81e020aef66a10c51, latest trunk

Operating system: Ubuntu 24.04.3 LTS

Architecture: X86-64

Extra Info

This was found by a fuzzer created with LLM assistance, however I have manually verified the repro case and written the report here. I'm a lot less familiar w/ Cranelift than LLVM, so apologies if this is an unsupported configuration (it is a pretty niche situation)

view this post on Zulip Wasmtime GitHub notifications bot (Nov 19 2026 at 00:18):

Benjins added the bug label to Issue #15362.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 19 2026 at 00:18):

Benjins added the cranelift label to Issue #15362.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 19 2026 at 16:49):

cfallin commented on issue #15362:

Thanks! FWIW, the single-pass regalloc is not tier-1 supported, and historically has had several bugs that have required us to disable it at various points. I don't know if anyone here has the bandwidth to look into this at the moment (I don't, at least). Perhaps we should disable it again (cc @fitzgen @alexcrichton for thoughts though)...

view this post on Zulip Wasmtime GitHub notifications bot (Nov 19 2026 at 18:25):

alexcrichton commented on issue #15362:

If this affects wasm, then I think it'd be ok to turn it off, but if this is CLIF-only then I think it'd be reasonable to leave it available for wasm use still. We've got a good number of CLIF-only bugs which I don't think are too too worrisome

view this post on Zulip Wasmtime GitHub notifications bot (Nov 19 2026 at 18:30):

cfallin commented on issue #15362:

sret is CLIF-only indeed, so I'm happy to leave this open to track in that case.


Last updated: Nov 19 2026 at 20:05 UTC