Skip to content

Fix assertion parsing typed refs in GC struct/array fields (#2750) - #2809

Open
ANAMASGARD wants to merge 1 commit into
WebAssembly:mainfrom
ANAMASGARD:fix-2750-typed-reference-fields
Open

Fix assertion parsing typed refs in GC struct/array fields (#2750)#2809
ANAMASGARD wants to merge 1 commit into
WebAssembly:mainfrom
ANAMASGARD:fix-2750-typed-reference-fields

Conversation

@ANAMASGARD

@ANAMASGARD ANAMASGARD commented Aug 7, 2026

Copy link
Copy Markdown

Fixes #2750

Summary

  • Fix WastParser::ParseField to preserve typed reference indices in GC struct/array fields
  • Defer VarToType for named refs until struct field storage is stable (avoids dangling pointers in resolve_ref_types_)
  • Add regress-2750.txt with non-zero index (ref 1) coverage
  • Add --enable-gc to run-roundtrip.py for GC roundtrip tests

Test plan

  • Issue reproducers (struct/array/mut (ref 0))
  • Non-zero index (ref 1)
  • Named deferred ref (ref $t1) via func type
  • test/run-tests.py regress-2750
  • Full test suite

…ly#2750)

Resolve indexed GC struct/array field types via var.to_type() for numeric
refs and defer VarToType for named refs until field storage is stable.
Fixes the assertion on (ref N) and preserves the referenced type index.

Signed-off-by: Gaurav Chaudhary <chaudharygaurav2004@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wat2wasm/wast2json: assertion failure (!IsReferenceWithIndex()) parsing a typed reference in a GC struct/array field

1 participant