Skip to content

Commit c2b3446

Browse files
authored
[test] Add test for table elems initialized by imported global funcref (#1641)
Fixes: #1640
1 parent 2a992ec commit c2b3446

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/core/elem.wast

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,3 +675,26 @@
675675

676676
(assert_return (invoke $m "get" (i32.const 0)) (ref.null extern))
677677
(assert_return (invoke $m "get" (i32.const 1)) (ref.extern 137))
678+
679+
;; Initializing a table with imported funcref global
680+
681+
(module $module4
682+
(func (result i32)
683+
i32.const 42
684+
)
685+
(global (export "f") funcref (ref.func 0))
686+
)
687+
688+
(register "module4" $module4)
689+
690+
(module
691+
(import "module4" "f" (global funcref))
692+
(type $out-i32 (func (result i32)))
693+
(table 10 funcref)
694+
(elem (offset (i32.const 0)) funcref (global.get 0))
695+
(func (export "call_imported_elem") (type $out-i32)
696+
(call_indirect (type $out-i32) (i32.const 0))
697+
)
698+
)
699+
700+
(assert_return (invoke "call_imported_elem") (i32.const 42))

0 commit comments

Comments
 (0)