You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RemoveUnusedModuleElements drops an active elem segment whose items are global.get, so call_indirect traps #9366
An active element segment whose item is global.get (the "Initializing a table with imported funcref global" case in the spec's elem.wast) is removed by --remove-unused-module-elements and at -O1 and above. The table slot stays null and call_indirect traps.
The same happens when $g is a defined global initialized with ref.func (with --enable-gc).
Tested with wasm-opt version_133; on main (95a214d) the pass differs from version_133 only by the NFC renames in #9286/#9288.
In src/passes/RemoveUnusedModuleElements.cpp, notePossibleFunc in Analyzer::prepare() only looks at item->dynCast<RefFunc>(), so a segment with global.get items never gets into FlatTableInfo::typeElems and is considered unused.
Found with a differential-testing tool; the report was drafted with AI assistance and reviewed and edited by me.
Activity