Skip to content

WAMR outputs LLVM ERROR #4528

@teyahb8

Description

@teyahb8

Subject of the issue

I generated a test case which I executed with different runtimes. Other runtimes like wasmtime, wasmer, wasmedge, and wamr's AOT mode outputs out of bounds exception. But, wamr's JIT mode outputs LLVM ERROR followed by a crash.

Test case

(module
  (type (;0;) (func (result v128 v128 v128 v128 i32 v128 v128 v128 v128 v128)))
  (memory (;0;) 0 1)
  (export "main" (func 0))
  (func (;0;) (type 0) (result v128 v128 v128 v128 i32 v128 v128 v128 v128 v128)
    (local v128)
    v128.const i32x4 0x9c184c7b 0x0b4b01ec 0x0f34f4cb 0x66297649
    local.set 0
    local.get 0
    i32x4.extract_lane 0
    v128.load8x8_s offset=1123 align=1
    local.tee 0
    local.get 0
    v128.const i32x4 0x84969263 0x1cd3f409 0xb2cf77d8 0x9154ed85
    i16x8.ne
    i32x4.max_s
    local.tee 0
    v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000
    f32x4.add
    local.get 0
    i32.const 6224
    i8x16.shr_u
    local.get 0
    i64x2.lt_s
    local.tee 0
    v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000
    i32x4.ge_s
    f32x4.sub
    local.get 0
    i32x4.trunc_sat_f32x4_s
    local.tee 0
    i32.const 170
    i64x2.shr_s
    local.tee 0
    v128.const i32x4 0x7598926e 0x5e66b8ab 0xc2efa8cd 0xdfc8f454
    v128.andnot
    v128.xor
    local.get 0
    v128.const i32x4 0xffffffff 0xffffffff 0xffffffff 0xffffffff
    i16x8.max_s
    local.get 0
    i32x4.lt_u
    local.tee 0
    v128.const i32x4 0xffffffff 0xffffffff 0xffffffff 0xffffffff
    i16x8.sub_sat_s
    i16x8.min_u
    local.get 0
    local.get 0
    v128.const i32x4 0xcbdb6b3b 0xc5c82046 0xb9bb9fb5 0x7276884c
    i8x16.narrow_i16x8_s
    local.tee 0
    i32x4.extmul_low_i16x8_u
    local.tee 0
    local.get 0
    f64x2.add
    f32x4.sub
    local.get 0
    v128.const i32x4 0xffffffff 0xffffffff 0xffffffff 0xffffffff
    i16x8.q15mulr_sat_s
    local.tee 0
    local.get 0
    i16x8.mul
    local.tee 0
    local.get 0
    i16x8.ge_s
    i32x4.ge_s
    local.get 0
    local.get 0
    i32x4.ge_s
    local.tee 0
    local.get 0
    f64x2.lt
    i32x4.lt_u
    local.tee 0
    v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000
    i8x16.shuffle 13 2 5 13 3 13 11 0 6 14 15 5 2 5 10 7
    local.tee 0
    local.get 0
    i32x4.add
    local.get 0
    i32.const 806
    i8x16.shr_u
    local.tee 0
    local.get 0
    i8x16.swizzle
    i16x8.max_s
    i32.const 739
    i32x4.shl
    v128.const i32x4 0x92101497 0x8db5c122 0xb4b99220 0xa88c5e77
    i64x2.extmul_high_i32x4_s
    local.get 0
    i32.const 7122
    i32x4.shr_s
    v128.const i32x4 0xc31e975c 0xdcb2f154 0xbdd79376 0xba1b2ba7
    i8x16.add_sat_u
    f64x2.pmax
    local.get 0
    i32.const 2605
    i64x2.shl
    v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000
    v128.const i32x4 0x63d7378b 0xe7fbd528 0x7218aa4a 0x4a1c03cc
    v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000
    v128.const i32x4 0xc174fc1c 0x7cbf7d5d 0xac7bd66d 0xf3ce226f
    local.get 0
    v128.const i32x4 0x4e50113c 0xc8feb817 0x85db4d89 0x7871ebbe
    drop
    drop
    i32.const 0
    select
    v128.const i32x4 0xffffffff 0xffffffff 0xffffffff 0xffffffff
    i32.const 5865
    i8x16.shr_s
    v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000
    local.get 0
    v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000
    i32x4.dot_i16x8_s
    i32.const 9329
    i32x4.shr_u
    v128.const i32x4 0x53432b45 0xf4af543b 0x8b6c1906 0x9dbea614
    v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000
    local.get 0
    local.get 0
    local.get 0
    local.get 0
    i32.const 1973104239
    local.get 0
    local.get 0
    local.get 0
    local.get 0
    local.get 0
    return
  )
)

Your environment

  • Host OS (Ubuntu 22.04)
  • WAMR version (2.3.1), platform (Linux), cpu architecture (x86_64), running mode (JIT), etc.

Steps to reproduce

  1. Convert wat to wasm.
  2. Run: iwasm --heap-size=0 --llvm-jit -f main shrunken_test2061838.wasm

Expected behavior

Exception: out of bounds memory access

Actual behavior

LLVM ERROR: Cannot select: 0x7ffddc0aee70: v4i32 = BUILD_VECTOR Constant:i32<65537>, Constant:i32<65537>, Constant:i32<65537>, Constant:i32<65537>
  0x7ffddc0ac6a0: i32 = Constant<65537>
  0x7ffddc0ac6a0: i32 = Constant<65537>
  0x7ffddc0ac6a0: i32 = Constant<65537>
  0x7ffddc0ac6a0: i32 = Constant<65537>
In function: aot_func#0
Aborted

Extra Info

Can you please confirm? Thanks in advance.

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