Stream: git-wasmtime

Topic: wasmtime / issue #7210 Cranelift: Zero and sign extension...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 10 2023 at 19:24):

bjorn3 added the bug label to Issue #7210.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 10 2023 at 19:24):

bjorn3 added the cranelift label to Issue #7210.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 10 2023 at 19:24):

bjorn3 opened issue #7210:

Thanks for filing an issue! Please fill out the TODOs below.

.clif Test Case

target x86_64

function u0:0(i8) system_v {
    sig0 = (i8 uext) system_v
    fn0 = u0:0 sig0

block0(v0: i8):
    call fn0(v0)
    return
}

Steps to Reproduce

Expected Results

v0 is zero-extended before passed to fn0.

Actual Results

No zero-extension happens, violating the System V ABI. This leads to miscompilations when linking against LLVM compiled code.

   0:   55                      pushq   %rbp
   1:   48 89 e5                movq    %rsp, %rbp
   4:   48 b8 00 00 00 00 00 00 00 00
                                movabsq $0, %rax
   e:   ff d0                   callq   *%rax
  10:   48 89 ec                movq    %rbp, %rsp
  13:   5d                      popq    %rbp
  14:   c3                      retq

Versions and Environment

Cranelift version or commit: 0.100.0 and 4c34504efb258a0c51c6a5f3f8a5b24d987993b9

Operating system: N/A

Architecture: x86_64

Extra Info

This is likely the root cause of https://github.com/bjorn3/rustc_codegen_cranelift/issues/1395.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 23 2023 at 16:10):

alexcrichton closed issue #7210:

Thanks for filing an issue! Please fill out the TODOs below.

.clif Test Case

target x86_64

function u0:0(i8) system_v {
    sig0 = (i8 uext) system_v
    fn0 = u0:0 sig0

block0(v0: i8):
    call fn0(v0)
    return
}

Steps to Reproduce

Expected Results

v0 is zero-extended before passed to fn0.

Actual Results

No zero-extension happens, violating the System V ABI. This leads to miscompilations when linking against LLVM compiled code.

   0:   55                      pushq   %rbp
   1:   48 89 e5                movq    %rsp, %rbp
   4:   48 b8 00 00 00 00 00 00 00 00
                                movabsq $0, %rax
   e:   ff d0                   callq   *%rax
  10:   48 89 ec                movq    %rbp, %rsp
  13:   5d                      popq    %rbp
  14:   c3                      retq

Versions and Environment

Cranelift version or commit: 0.100.0 and 4c34504efb258a0c51c6a5f3f8a5b24d987993b9

Operating system: N/A

Architecture: x86_64

Extra Info

This is likely the root cause of https://github.com/bjorn3/rustc_codegen_cranelift/issues/1395.


Last updated: Dec 23 2024 at 13:07 UTC