wasm-micro-runtime icon indicating copy to clipboard operation
wasm-micro-runtime copied to clipboard

Unexpected execution in fast interpreter mode

Open erxiaozhou opened this issue 1 year ago • 1 comments

Subject of the issue

The WAMR on faster interpreter mode has a wrong execution result on the test case.

Test case

tt2.zip

(module
  (type (;0;) (func))
  (type (;1;) (func (result i32)))
  (type (;2;) (func (param f32) (result f32)))
  (func (;0;)  (result i64)
    i32.const -1518330408
    i64.const 1022
    i64.const 904
    i64.add
    global.get 0
    i64.add
    global.set 0
    f32.const 0x1.01499cp+1 (;=2.01006;)
    call 1
    i32.const 0
    if (param f32) (result f32)  ;; label = @1
    end
    i64.trunc_f32_u
    return
    )
  (func (;1;) (type 2) (param f32) (result f32)
    f32.const inf (;=inf;))
  (global (;0;) (mut i64) (i64.const 858))
  (global (;1;) (mut f64) (f64.const 0x1.0370499c98398p+3 (;=8.10746;)))
  (export "_start" (func 0))
  (export "to_test" (func 0)))


Your environment

  • Host OS: Ubuntu 20.04
  • Commit Id: 835188cc53373159165423debc48242ad15548d6

Steps to reproduce

  1. build WAMR in fast interpreter mode
  2. execute the command
iwasm --heap-size=0 -f "to_test" <test_case>

Expected behavior

An exception indicating integer overflow (On the instruction i64.trunc_f32_u)

Actual behavior

0

erxiaozhou avatar May 02 '24 09:05 erxiaozhou

@erxiaozhou thanks for reporting the issue, it is similar to #3386 when handling the if block in loader:

    if (param f32) (result f32)  ;; label = @1
    end

Please try #3404.

wenyongh avatar May 08 '24 10:05 wenyongh

Close the issue since it was fixed.

wenyongh avatar May 14 '24 10:05 wenyongh