-
Notifications
You must be signed in to change notification settings - Fork 790
Fix checking of ref.func index declarations #1894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix checking of ref.func index declarations #1894
Conversation
The validation was overly strict for ref.func index uses. In the spec, the ref index just needs to appear in "the set of function indices occurring in the module, except in its functions or start function." which includes uses in the global and export sections. Fixes issue WebAssembly#1893
|
This looks right to me (you may have seen #1888 where I tried to work around this). What do you think about https://github.com/WebAssembly/wabt/blob/main/test/spec/unreached-valid.txt , which seems to be the other test with failed validation? |
sbc100
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this. I do wonder if we are lacking in test coverage (in the spec repo) given that the overall number of passing/failing tests stayed the same here (only the specific outout text changed).
The problem there seems to be that the validation semantics of |
Thanks for the feedback, I think I've addressed the comments. Re: tests, I think the issue here is that a spec test command like |
OK, that sounds like maybe something we should fix but is not related to this change. Are you saying that if wabt can fail to validate such a |
Right, because just a Just adding a |
|
#1895 is my attempt to address this with the smallest possible change (bombing out on error instead of adding TallyCommand and updating all tests). |
The validation was overly strict for ref.func index uses. In the spec, the ref index just needs to appear in
(https://webassembly.github.io/spec/core/valid/modules.html#valid-module)
which includes uses in the global and export sections. There were some test failures in the spec tests that were fixed by this, so the PR also changes test expectations.
Fixes issue #1893