Stream: git-wasmtime

Topic: wasmtime / issue #11232 Cranelift: s390x `load` produces ...


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

akldc opened issue #11232:

.clif Test Case

test optimize
set opt_level=none
set preserve_frame_pointers=true
set enable_multi_ret_implicit_sret=true
set enable_nan_canonicalization=true

function %main() -> i64x2 fast {
    ss0 = explicit_slot 32

block0:
    v4 = iconst.i64 0x3c37_33b7_38fd_cbe8

    v14 = stack_addr.i64 ss0
    store little v4, v14
    store little v4, v14+8
    store little v4, v14+16
    store little v4, v14+24

    v17 = stack_addr.i64 ss0
    v18 = load.i64x2 v17
    return v18
}

; print: %main()

Versions and Environment

Target Architecture: s390x

Environment: qemu-s390x to emulate execution on the x86 machine.

Steps to Reproduce

Execute using run and interpret respectively.

$ clif-util run -v test.clif
$ clif-util interpret -v test.clif

Actual Results

[run   ] %main() -> 0xe8cbfd38b733373ce8cbfd38b733373c
[interp] %main() -> 0x3c3733b738fdcbe83c3733b738fdcbe8

The load instruction reads in big-endian under the run command, but in little-endian under interpret.
This inconsistency probably needs to be fixed.

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

akldc added the bug label to Issue #11232.

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

akldc added the cranelift label to Issue #11232.

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

alexcrichton closed issue #11232:

.clif Test Case

test optimize
set opt_level=none
set preserve_frame_pointers=true
set enable_multi_ret_implicit_sret=true
set enable_nan_canonicalization=true

function %main() -> i64x2 fast {
    ss0 = explicit_slot 32

block0:
    v4 = iconst.i64 0x3c37_33b7_38fd_cbe8

    v14 = stack_addr.i64 ss0
    store little v4, v14
    store little v4, v14+8
    store little v4, v14+16
    store little v4, v14+24

    v17 = stack_addr.i64 ss0
    v18 = load.i64x2 v17
    return v18
}

; print: %main()

Versions and Environment

Target Architecture: s390x

Environment: qemu-s390x to emulate execution on the x86 machine.

Steps to Reproduce

Execute using run and interpret respectively.

$ clif-util run -v test.clif
$ clif-util interpret -v test.clif

Actual Results

[run   ] %main() -> 0xe8cbfd38b733373ce8cbfd38b733373c
[interp] %main() -> 0x3c3733b738fdcbe83c3733b738fdcbe8

The load instruction reads in big-endian under the run command, but in little-endian under interpret.
This inconsistency probably needs to be fixed.

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

alexcrichton commented on issue #11232:

I believe this is intended behavior where the interpreter is emulating a little-endian machine but s390x is a big-endian machine, so I don't believe there's a bug here. Thanks though for the report!

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

cfallin commented on issue #11232:

And specifically, we have decided that loads without a big or little flag are "native" endian, which means that the CLIF execution semantics depend on the target. If you're doing cross-target fuzzing, you'll need to account for this (and probably you'd do best to explicitly add endianness to all loads/stores).

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

bjorn3 commented on issue #11232:

I did expect the interpreter to take the target to emulate as argument to allow cross-testing.


Last updated: Dec 06 2025 at 06:05 UTC