Skip to content

Cranelift: unexpected panic on riscv64: called Option::unwrap() on a None value #11183

@akldc

Description

@akldc

.clif Test Case


test optimize
set opt_level=none
set preserve_frame_pointers=true
set enable_multi_ret_implicit_sret=true
target x86_64 sse42 has_avx
target aarch64 
target s390x
target riscv64gc  has_zcd has_zbkb has_zbc has_zbs has_zicond has_zvl32b has_zvl64b has_zvl128b has_zvl1024b has_zvl2048b has_zvl4096b has_zvl8192b has_zvl16384b has_zvl32768b

function u1:6(f32, f32) -> f32, f32  {
block0(v0: f32, v1: f32):
    return v0, v0
}


function u1:5(i64 , f32) ->  f32  {
    sig0 = (f32, f32) -> f32, f32 
    fn0 = u1:6 sig0

block0(v0: i64, v1: f32):
    v17 = iconst.i64 0
    v23 = f32const 0x1.5270eep-1
    v24 = select_spectre_guard.f32 v0, v1, v23
    v26, v27 = call fn0(v23, v24)
    return  v23
}

function %main() -> f32  {
    sig0 = (i64 , f32) ->  f32 
    fn0 = u1:5 sig0

block0:
    v3 = iconst.i64 23
    v4 = f32const 0x1.5270eep-1
    v5 = call fn0(v3,v4)
    return v5
}

; print: %main()


Result

[x86    ] %main() -> 0x1.5270eep-1
return code: 0

[riscv64] thread 'main' panicked at cranelift/codegen/src/isa/riscv64/lower/isle.rs:169:22:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
return code: 101

I tried removing the instruction v26, v27 = call fn0(v23, v24), and that made the case run successfully.
I'm not sure whether this issue is related to #10951

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIncorrect behavior in the current implementation that needs fixingcraneliftIssues related to the Cranelift code generatorcranelift:area:riscv64Issues related to the RISC-V 64 backend.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions