Skip to content

Inconsistent error types and return codes for srem(0, 0) across architectures #11012

@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() -> i32 fast {

block0():
    v2 = iconst.i32 0
    v16 = srem v2, v2
    return v16
}

; print: %main()

Run this test case on four architectures.

[x86    ] Floating point exception
return code: -8

[aarch64] qemu: uncaught target signal 4 (Illegal instruction) - core dumped
[aarch64] Illegal instruction
return code: -4

[riscv64] Illegal instruction
return code: -4

[s390x  ] qemu: uncaught target signal 8 (Floating point exception) - core dumped
[s390x  ] Illegal instruction
return code: -8

When running srem with operands 0 and 0, the error types and return values are inconsistent among the four architectures.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIncorrect behavior in the current implementation that needs fixingcraneliftIssues related to the Cranelift code generator

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions