Skip to content

wasm simd: folded xor and unaligned load incorrectly "traps" #2943

Description

@alexcrichton

Given this wasm:

(module
  (memory 1)
  (func (export "_start")
        call 1
        drop)

  (func (result v128)
    v128.const i32x4 0 0 0 0
    i32.const 1
    v128.load
    v128.xor)
)

when run this yields:

$ cargo run -- --enable-simd foo.wat
    Finished dev [unoptimized + debuginfo] target(s) in 0.20s
     Running `target/debug/wasmtime --enable-simd foo.wat`
Error: failed to run main module `foo.wat`

Caused by:
    0: failed to invoke command default
    1: wasm trap: out of bounds memory access
       wasm backtrace:
           0:   0x4b - <unknown>!<wasm function 1>
           1:   0x2d - <unknown>!<wasm function 0>

It looks like in the disassembly pxor is being used with a memory operand, but presumably that memory operand needs to be aligned and the instruction is trapping otherwise?

cc @abrown, @jlb6740

Metadata

Metadata

Assignees

Labels

bugIncorrect behavior in the current implementation that needs fixingwasm-proposal:simdIssues related to the WebAssembly SIMD proposal

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions