Skip to content
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

wat2wasm aborts when function has undefined reference type in parameter #2097

Open
imofftoseethewizard opened this issue Dec 4, 2022 · 1 comment

Comments

@imofftoseethewizard
Copy link

The following module

(module
  (func (param (ref $T)) (result)
    (nop)))

aborts in both the current main HEAD and the most recent package version on Ubuntu 20.04:

pat@quercus:~/src/crack$ ../wabt/bin/wat2wasm --version
1.0.31 (git~1.0.31-22-ged0b720c)

pat@quercus:~/src/crack$ ../wabt/bin/wat2wasm --enable-function-references scratch.wat -o scratch.wasm
wat2wasm: /home/pat/src/wabt/src/wast-parser.cc:327: void wabt::(anonymous namespace)::ResolveTypeName(const wabt::Module &, wabt::Type &, wabt::Index, const std::unordered_map<uint32_t, std::string> &): Assertion `type_index != kInvalidIndex' failed.
Aborted (core dumped)

pat@quercus:~/src/crack$ wat2wasm --version
1.0.27

pat@quercus:~/src/crack$ wat2wasm --enable-function-references scratch.wat -o scratch.wasm
wat2wasm: ./src/wast-parser.cc:279: void wabt::{anonymous}::ResolveTypeName(const wabt::Module&, wabt::Type&, wabt::Index, const std::unordered_map<unsigned int, std::__cxx11::basic_string<char> >&): Assertion `type_index != kInvalidIndex' failed.
Aborted (core dumped)

If (ref $T) is replaced with $T, I get an error message. Not a huge problem, just a little confusing.

@keithw
Copy link
Member

keithw commented Dec 4, 2022

Thanks. I believe this is the same issue as #1890 / #1892. AFAIK support for function-references remains a work in progress in WABT -- we're not running the function-references tests, I don't think we really support these instructions yet, and we don't even mention function-references in our README.

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

No branches or pull requests

2 participants