-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
bugIncorrect behavior in the current implementation that needs fixingIncorrect behavior in the current implementation that needs fixingwinchWinch issues or pull requestsWinch issues or pull requests
Description
Test Case
This test, when compiled to webassembly, succeeds with cranelift and fails on winch. (both succeed on x86). The compiled wasm is attached.
#![no_std]
use sha2::Digest;
use hex_literal::hex;
#[unsafe(export_name = "FFFFFFFFFFFFFFFF")]
pub extern "C" fn test_hello() -> () {
let hash = sha2::Sha256::digest(b"hello");
let expect : [u8;32] = hex!("2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824");
assert_eq!(hash, expect.into());
}
Steps to Reproduce
wasmtime run --codegen compiler=winch --invoke FFFFFFFFFFFFFFFF hash_bug.wasm
wasmtime run --codegen compiler=cranelift --invoke FFFFFFFFFFFFFFFF hash_bug.wasm
Expected Results
Both commands should run the wasm function and exit 0.
Actual Results
Cranelift succeeds, winch fails.
% wasmtime run --codegen compiler=cranelift --invoke FFFFFFFFFFFFFFFF hash_bug.wat
% wasmtime run --codegen compiler=winch --invoke FFFFFFFFFFFFFFFF hash_bug.wat
Error: failed to run main module `hash_bug.wat`
Caused by:
0: failed to invoke `FFFFFFFFFFFFFFFF`
1: error while executing at wasm backtrace:
0: 0x7a4 - hash_bug.wasm!FFFFFFFFFFFFFFFF
2: wasm trap: wasm `unreachable` instruction executed
Versions and Environment
Wasmtime: 41.0.0 (bug also present on 40.0.0. I have not tested earlier versions)
Operating system: MacOS Tahoe 26.2
Architecture: Aarch64
Extra Info
I attach the compiled wasm module below (as a WAT, renamed to a .txt; github won't allow a .wat or .wasm upload).
Metadata
Metadata
Assignees
Labels
bugIncorrect behavior in the current implementation that needs fixingIncorrect behavior in the current implementation that needs fixingwinchWinch issues or pull requestsWinch issues or pull requests