bad wast generation for gcc torture test bcp-1.c
Closed this issue · 1 comments
binji commented
See bcp-1.c
The .s output is:
...
# BB#6: # %for.cond.5
block
i32.const $push12=, 0
i32.load $push13=, bad_t1($pop12)
i32.const $push14=, 1
i32.call_indirect $push15=, $pop13, $pop14
br_if $pop15, 0 # 0: down to label1
...
s2wasm generates:
(block $label$1
(br_if
(call_indirect $FUNCSIG_ii
(i32.const 1)
(i32.load offset=40 align=4
(i32.const 0)
)
)
$label$1
)
Notice that the function index (the i32.load
) is after the first argument (i32.const 1)
. They should be in the other order.
kripken commented
Thanks, fixed. Our call_indirect code only took into account the reverse order of operands for the call operands and not the target itself.