Closed eqrion closed 1 year ago
I hit this exact case a couple days ago too. AFAICT this was introduced in the function-references
proposal but only the GC repo has a test for it. I had asked @rossberg offline about how this is handled in the reference interpreter.
Was the global reference intended behavior? Because that implies initializer expressions cannot be checked until after the global section, because it cannot get the type of the global otherwise. Also, that implies a parser needs to be able to parse instructions (to compute init expr length) without actually typechecking them.
Indeed, this was an oversight in #420, thanks for pointing out. PTAL at #434.
See https://github.com/WebAssembly/gc/blob/main/test/core/global.wast#L622.
This module is supposed to be valid, and has a table with a default value expression referencing a global. However the global section comes after the table section, so when validating the global.get in the table,
$gn
has not been decoded yet.Also, it looks like the text format for table default value initializers is not written yet.