wasm-micro-runtime
wasm-micro-runtime copied to clipboard
Unexpected execution result on fast interpreter mode
trafficstars
Subject of the issue
The WAMR on faster interpreter mode has a wrong execution result on the test case.
Test case
(module
(type (;0;) (func))
(type (;1;) (func (result i32)))
(type (;2;) (func (param i32 i32) (result i32 i32)))
(func (;0;) (type 1) (result i32)
f32.const -0x1.0bb6d6p+2 (;=-4.18303;)
f32.const -0x1.2a640ap+2 (;=-4.66236;)
f32.ge
i32.const 353
call 1
i32.const 0
if (param i32 i32) (result i32 i32) ;; label = @1
end
i32.gt_u
return
)
(func (;1;) (type 2) (param i32 i32) (result i32 i32)
i32.const -1
i32.const 2147483647)
(export "_start" (func 0))
(export "to_test" (func 0)))
Your environment
- Host OS: Ubuntu 20.04
- Commit Id: 835188cc53373159165423debc48242ad15548d6
Steps to reproduce
- build WAMR in fast interpreter mode
- execute the command
iwasm --heap-size=0 -f "to_test" <test_case>
Expected behavior
1
Actual behavior
0
@erxiaozhou thanks for reporting the issue, it is mainly caused by the handling of an if block without else opcode for fast interpreter:
if (param i32 i32) (result i32 i32) ;; label = @1
end
I submitted PR #3404 to fix it, please try again.