Add a test for non-treelike behavior of stack (#961)

We've recently found a bug in a WebAssembly library we've been working
with where we're mapping WebAssembly to a tree-like IR internally. The
way we parse into this representation, however, has a bug when the
function isn't itself tree-like but rather exibits properties that
exploit a stack machine. For example this isn't so straightforward to
represent in a tree-like fashion:

    (import "" "a" (func $foo))
    (import "" "b" (func $foo (result i32)))
    (func (result i32)
      call $b
      call $b
      call $a

The extra `call $a` in the middle is valid `WebAssembly` but needs
special treatment when converting to a more tree-like IR format. I
figured it'd be good to ensure there's a spec test covering this case as
we currently pass the suite of spec tests but still contain this bug!
1 file changed
tree: ee9387dfd1df6601666e1af8aeeffaa36cc8ead3
  1. .gitattributes
  2. .gitignore
  3. .gitmodules
  4. .travis.yml
  8. deploy_key.enc
  9. document/
  10. interpreter/
  11. papers/
  12. proposals/
  13. test/
  14. w3c.json

Build Status


This repository holds the sources for the WebAssembly draft specification (to seed a future WebAssembly Working Group), a reference implementation, and the official testsuite.

A formatted version of the spec is available here:,

Participation is welcome. Discussions about new features, significant semantic changes, or any specification change likely to generate substantial discussion should take place in the WebAssembly design repository first, so that this spec repository can remain focused. And please follow the guidelines for contributing.