Conversation
| // Execute an expression in global init | ||
| class GlobalInitRunner : public ExpressionRunner<GlobalInitRunner> { | ||
| public: | ||
| Flow visitLoop(Loop* curr) { WASM_UNREACHABLE(); } |
There was a problem hiding this comment.
This should probably result in some kind of validation error, rather than WASM_UNREACHABLE (since otherwise well-formed input could reach this code?)
There was a problem hiding this comment.
This code is reached when we execute the init statement for the global, which is when we instantiate the module, which is after we fully parse and validate it. That means we can assume the expression is valid, in which case none of these unreachables would be hit. Assuming we don't have a bug in our validation ;)
There was a problem hiding this comment.
Got it; but I don't see code for that in wasm-validator.h?
There was a problem hiding this comment.
Look at https://github.com/WebAssembly/binaryen/pull/650/files/0dc286f78cd3d5d1f5fd1cb21c16485cd9f2fd1f#diff-33a3856e71772f6165f55c85cb076496R264 , it's actually a stronger check than needed - it only accepts Const (because that's all that is tested currently, and I'm not sure what else will be allowed).
Support for the new globals preparing to land in the spec repo,
WebAssembly/spec#313
This passes the wast test in that PR.