Skip to content

Incorrect handling of multiple return values with v128, causing segmentation fault #3965

@Q1IQ

Description

@Q1IQ

Subject of the issue

iwasm fails to handle multiple return values when one of them is a v128, causing a segmentation fault.

Test c

program.wasm.txt

(module
  (type (func (param i32 i32) (result i64 v128))) 
  (func $func1 (type 0) (param i32 i32) (result i64 v128)
    i64.const 0x1234567890
    (v128.const i32x4 0x00000004 0x34567890 0x66666666 0x77777777)
  )
  
  (func $main (result i64 v128)
    i32.const 0x12341234 
    i32.const 0x1234    
    call $func1
  )
  
  (export "main" (func $main)) 
)

Your environment

  • OS: Ubuntu 20.04
  • CPU: amd64
  • WAMR version: iwasm 1.2.3
  • Command: iwasm --llvm-jit ./program_call_indirect.wasm

Steps to reproduce

Run the WebAssembly module, and get the output:

$  iwasm --llvm-jit  -f main ./program.wasm
fast jit compilation failed: Error: unsupported opcode
failed to compile fast jit function 0
fast jit compilation failed: unknown error
failed to compile fast jit function 1
Segmentation fault (core dumped)

Expected behavior

The module should correctly handle multiple return values including v128. A valid output should look like:

0x1234567890:i64,<0x3456789000000004 0x7777777766666666>:v128

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions