Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/wasm/wasm-validator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2879,7 +2879,7 @@ void FunctionValidator::visitStructSet(StructSet* curr) {
return;
}
auto type = curr->ref->type.getHeapType();
if (type == HeapType::none) {
if (type.isBasic() && type.getBasic(Unshared) == HeapType::none) {
return;
}
if (!shouldBeTrue(
Expand Down
28 changes: 26 additions & 2 deletions test/spec/shared-array.wast
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@
(type $i8 (shared (array (mut i8))))
(type $i32 (shared (array (mut i32))))
(type $unshared (array (mut i8)))
(type $funcs (shared (array (mut (ref null (shared any))))))

(data)
(elem)
(elem (ref null (shared any)))

(func (array.new $i8 (i32.const 0) (i32.const 0)) (drop))

Expand Down Expand Up @@ -110,6 +111,29 @@
(func (param (ref null $i8))
(array.init_data $i8 0 (local.get 0) (i32.const 0) (i32.const 0) (i32.const 0)))

(func (param (ref null $funcs))
(array.init_elem $funcs 0 (local.get 0) (i32.const 0) (i32.const 0) (i32.const 0)))
)

;; Bottom types
(module
(type $i8 (shared (array (mut i8))))
(type $i32 (shared (array (mut i32))))
(type $funcs (shared (array (mut (ref null (shared func))))))

(data)
(elem (ref null (shared any)))

(func (array.get_s $i8 (ref.null (shared none)) (i32.const 0)) (drop))
(func (array.get_u $i8 (ref.null (shared none)) (i32.const 0)) (drop))
(func (array.get $i32 (ref.null (shared none)) (i32.const 0)) (drop))
(func (array.set $i8 (ref.null (shared none)) (i32.const 0) (i32.const 0)))
(func (param (ref null $i8))
(array.init_data $i8 0 (local.get 0) (i32.const 0) (i32.const 0) (i32.const 0)))
(array.copy $i8 $i8 (ref.null (shared none)) (i32.const 0) (local.get 0) (i32.const 0) (i32.const 0)))
(func (param (ref null $i8))
(array.copy $i8 $i8 (local.get 0) (i32.const 0) (ref.null (shared none)) (i32.const 0) (i32.const 0)))
(func (array.copy $i8 $i8 (ref.null (shared none)) (i32.const 0) (ref.null (shared none)) (i32.const 0) (i32.const 0)))
(func (array.fill $i8 (ref.null (shared none)) (i32.const 0) (i32.const 0) (i32.const 0)))
(func (array.init_data $i8 0 (ref.null (shared none)) (i32.const 0) (i32.const 0) (i32.const 0)))
(func (array.init_elem $funcs 0 (ref.null (shared none)) (i32.const 0) (i32.const 0) (i32.const 0)))
)
8 changes: 8 additions & 0 deletions test/spec/shared-struct.wast
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,11 @@
(func (param (ref null $i8))
(struct.set $i8 0 (local.get 0) (i32.const 0)))
)

;; Bottom types
(module
(type $i8 (shared (struct (mut i8))))
(func (drop (struct.get_s $i8 0 (ref.null (shared none)))))
(func (drop (struct.get_u $i8 0 (ref.null (shared none)))))
(func (struct.set $i8 0 (ref.null (shared none)) (i32.const 0)))
)