Skip to content

Commit f846dd1

Browse files
committed
Add an unualigned data segment access test for array.new_data
1 parent 4c10619 commit f846dd1

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/core/gc/array_new_data.wast

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,18 @@
5151

5252
;; Data segments are interpreted as little-endian.
5353
(assert_return (invoke "array-new-data-little-endian") (i32.const 0xddccbbaa))
54+
55+
(module
56+
(type $arr (array (mut i16)))
57+
58+
(data $d "\00\11\22")
59+
60+
(func (export "array-new-data-unaligned") (result i32)
61+
(array.get_u $arr
62+
(array.new_data $arr $d (i32.const 1) (i32.const 1))
63+
(i32.const 0))
64+
)
65+
)
66+
67+
;; Data inside the segment doesn't need to be aligned to the element size.
68+
(assert_return (invoke "array-new-data-unaligned") (i32.const 0x2211))

0 commit comments

Comments
 (0)