-
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 fixingcraneliftIssues related to the Cranelift code generatorIssues related to the Cranelift code generatorcranelift:area:riscv64Issues related to the RISC-V 64 backend.Issues related to the RISC-V 64 backend.
Description
Summary
When compiling large functions targeting riscv64gc with compressed instructions (Zca) enabled, emit_veneer() panics because the veneer is placed too far from the original C.J.
The island emission deadline mechanism is supposed to force island emission before any label reference goes out of range, but, presumably, the deadline calculation doesn't account for the very small range of C.J when traps and constants are flushed before veneers — these can push the veneer past the 2 KiB limit.
.clif Test Case
Steps to Reproduce
$ clif-util test rvcjump_bug_reduced.clif
Expected Results
Success
Actual Results
thread 'worker #0' panicked at cranelift/codegen/src/isa/riscv64/inst/mod.rs:1759:9:
RVCJump offset '2048' use_offset:'7416' label_offset:'9464' must not exceed max range.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[2026-03-20T19:04:21Z ERROR cranelift_filetests::concurrent] FAIL: panicked in worker #0: RVCJump offset '2048' use_offset:'7416' label_offset:'9464' must not exceed max range.
FAIL rvcjump_bug_reduced.clif: panicked in worker #0: RVCJump offset '2048' use_offset:'7416' label_offset:'9464' must not exceed max range.
1 tests
Error: 1 failure
Versions and Environment
Cranelift version or commit: 0.122.0
Operating system: Linux Manjaro
Architecture: x86_64 cross-compiling to riscv64gc
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugIncorrect behavior in the current implementation that needs fixingIncorrect behavior in the current implementation that needs fixingcraneliftIssues related to the Cranelift code generatorIssues related to the Cranelift code generatorcranelift:area:riscv64Issues related to the RISC-V 64 backend.Issues related to the RISC-V 64 backend.