Mutated Immutable
This checks for globals, WasmGC struct fields and arrays that are not declared mutable, but are mutated unexpectedly.
Specifically:
global.set
will mutate a globalstruct.set
will mutate a WasmGC struct fieldarray.set
,array.fill
,array.init_data
andarray.init_elem
will mutate a WasmGC array
Global types and field types aren't defined with a mut
keyword are immutable. It's invalid to mutate them.
Globals
wasm
(module
(global i32
i32.const 0)
(func
(global.set 0
(i32.const 0))))
Struct Fields
wasm
(module
(type (struct (field i32)))
(func (param (ref 0))
local.get 0
i32.const 0
struct.set 0 0))
Arrays
wasm
(module
(type (array i32))
(func (param (ref 0))
local.get 0
i32.const 0
i32.const 0
array.set 0))