Skip to content

Cranelift: Incorrect bitcast result in interpret backend: return value overwritten #11240

@akldc

Description

@akldc

.clif Test Case

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

function %main() ->  i16, i16x8, i32x4 fast {

    const0 = 0xc07a84a9c07a84a9c07a84a9c07a84a9

block0:   
    v3 = iconst.i16 -24145
    v5 = iconst.i64 0x41de_6f84_61b3_a1af
    v6 = uextend.i128 v5 
    v7 = bitcast.i16x8 little v6
    v11 = vconst.i32x4 const0
    return v3, v7, v11
}

; print: %main()

Steps to Reproduce

Execute using run and interpret respectively.

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

Results

$ clif-util run -v test1.clif
%main() -> [-24145, 0x000000000000000041de6f8461b3a1af, 0xc07a84a9c07a84a9c07a84a9c07a84a9]
test1.clif
1 file
$ clif-util interpret -v test1.clif
%main() -> [-24145, -24145, 0xc07a84a9c07a84a9c07a84a9c07a84a9]
test1.clif
1 file

Clearly, under the interpret command, the return variable v7 incorrectly returns the value of v3.

Versions and Environment

Operating system: Ubuntu 22.04

Architecture: x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIncorrect behavior in the current implementation that needs fixingcraneliftIssues related to the Cranelift code generatorcranelift:area:interpreterIssues related to the Cranelift interpreter

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions