Skip to content

Commit

Permalink
Add an unualigned data segment access test for array.new_data
Browse files Browse the repository at this point in the history
  • Loading branch information
fitzgen committed Sep 28, 2024
1 parent 4c10619 commit f846dd1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/core/gc/array_new_data.wast
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,18 @@

;; Data segments are interpreted as little-endian.
(assert_return (invoke "array-new-data-little-endian") (i32.const 0xddccbbaa))

(module
(type $arr (array (mut i16)))

(data $d "\00\11\22")

(func (export "array-new-data-unaligned") (result i32)
(array.get_u $arr
(array.new_data $arr $d (i32.const 1) (i32.const 1))
(i32.const 0))
)
)

;; Data inside the segment doesn't need to be aligned to the element size.
(assert_return (invoke "array-new-data-unaligned") (i32.const 0x2211))

0 comments on commit f846dd1

Please sign in to comment.