Skip to content

UNREACHABLE Trap in v128.load8_splat with memidx ≠ 0 #544

@akldc

Description

@akldc

Test Case

(module
  (type $0 (struct (field (mut f32))))
  (type $1 (func (result v128 (ref 0))))
  (type $2 (func (result v128 f32)))
  (type $3 (func (param v128 (ref 0)) (result v128 f32)))
  (type $4 (func (result v128 i32)))
  (memory $0 1 2)
  (memory $1 1 1)
  (export "f0" (func 0))
  (export "f1" (func 1))
  (func $0
    (type 1)
    (local i64)
    (i32.const 2)
    (v128.load8_splat 1 offset=2)
    (struct.new_default 0)
  )
  (func $1 
    (type 4)   
    (call 0)
    (ref.is_null)
  )
)

Description

Executing the above case will result in the following error.

$ wizeng.x86-64-linux --print-result=true --invoke=f1 test1.wasm
<wasm func "1"> +1
  <wasm func "0"> +12
    !trap[UNREACHABLE]

Set the parameter of v128.load8_splat to 0 (i.e., v128.load8_splat 0 offset=2) to obtain the correct result.

$ wizeng.x86-64-linux --print-result=true --invoke=f1 test1.wasm
v128:0000000000000000_0000000000000000 0

v128.load8_splat appears to mishandle non-zero memory indices; using memidx = 1 causes an UNREACHABLE trap, while memidx = 0 works correctly.

Environment

Wizard Engine 25β.2902
Ubuntu 20.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions