Skip to content

Commit 740c560

Browse files
committed
review: check element initializers
1 parent 648c733 commit 740c560

File tree

1 file changed

+17
-0
lines changed
  • test/core/shared-everything-threads/shared-everything-threads

1 file changed

+17
-0
lines changed

test/core/shared-everything-threads/shared-everything-threads/tables.wast

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,23 @@
3939
(module quote "(table shared i64 (ref null (shared func)) (elem (ref.null (shared func))))")
4040
"expected a u64")
4141

42+
;; A shared table must be initialized from shared objects.
43+
(module
44+
(type $f (shared (func)))
45+
(global $g (shared (ref null $f)) (ref.null $f))
46+
(table $t shared 1 (ref null $f))
47+
(elem (ref null $f) (global.get $g))
48+
)
49+
(assert_invalid
50+
(module
51+
(type $f (shared (func)))
52+
(global $g (ref null $f) (ref.null $f))
53+
(table $t shared 1 (ref null $f))
54+
;; When we initialize a shared element, everything must be shared, including
55+
;; the used global.
56+
(elem (ref null $f) (global.get $g)))
57+
"invalid type")
58+
4259
;; Check `table.atomic.*` instructions.
4360
(module (;eq;)
4461
(table $a (import "spectest" "table_eq") shared 1 (ref null (shared eq)))

0 commit comments

Comments
 (0)