Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cranelift: Wrong result for urem.i8 on RISC-V #7245

Closed
afonso360 opened this issue Oct 15, 2023 · 0 comments · Fixed by #7268
Closed

Cranelift: Wrong result for urem.i8 on RISC-V #7245

afonso360 opened this issue Oct 15, 2023 · 0 comments · Fixed by #7268
Labels
bug Incorrect behavior in the current implementation that needs fixing cranelift:area:riscv64 Issues related to the RISC-V 64 backend. cranelift Issues related to the Cranelift code generator

Comments

@afonso360
Copy link
Contributor

👋 Hey,

Fuzzgen found this today.

.clif Test Case

test interpret
test run
target riscv64gc

function %a() -> i8  {
block0:
    v3 = iconst.i8 208
    v11 = urem v3, v3  ; v3 = 208, v3 = 208
    return v11
}

; run: %a() == 0

Steps to Reproduce

  • clif-util test ./the-above.clif

Expected Results

The test to pass.

Actual Results

afonso@DESKTOP-1AHKMV2:~/git/wasmtime/cranelift$ cargo run --target=riscv64gc-unknown-linux-gnu -- test ./lmao.clif 
    Finished dev [unoptimized + debuginfo] target(s) in 0.15s
     Running `/home/afonso/git/qemu/build/qemu-riscv64 -L /usr/riscv64-linux-gnu -E LD_LIBRARY_PATH=/usr/riscv64-linux-gnu/lib -E WASMTIME_TEST_NO_HOG_MEMORY=1 -cpu rv64,v=true,vlen=128,vext_spec=v1.0,zba=true,zbb=true,zbs=true,zbc=true,zbkb=true,zcb=true,x-zicond=true /home/afonso/git/wasmtime/target/riscv64gc-unknown-linux-gnu/debug/clif-util test ./lmao.clif`
 ERROR cranelift_filetests::concurrent > FAIL: run
FAIL ./lmao.clif: run

Caused by:
    Failed test: run: %a() == 0, actual: -48
1 tests
Error: 1 failure

Versions and Environment

Cranelift version or commit: main

Operating system: Linux

Architecture: RISC-V 64

@afonso360 afonso360 added bug Incorrect behavior in the current implementation that needs fixing cranelift Issues related to the Cranelift code generator cranelift:area:riscv64 Issues related to the RISC-V 64 backend. labels Oct 15, 2023
alexcrichton added a commit to alexcrichton/wasmtime that referenced this issue Oct 17, 2023
This was mistakenly left out of my recent refactor for
remainder/division.

Closes bytecodealliance#7245
github-merge-queue bot pushed a commit that referenced this issue Oct 17, 2023
This was mistakenly left out of my recent refactor for
remainder/division.

Closes #7245
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior in the current implementation that needs fixing cranelift:area:riscv64 Issues related to the RISC-V 64 backend. cranelift Issues related to the Cranelift code generator
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant