Description
This test will be disable due to the zig 0.11 llvm 16 branch.
It sounds like the issues potentially quite complex due to how dev wasm models the stack machine.
Context
As an extra note, I tried to debug this some yesterday. Initially, I thought it was a bug directly with checked addition, but when writing a unit test just for checked addition, it seemed to work. So my current guess is somehow we mess up the lambda and that leads to the wrapped checked addition not working correctly. That or somewhere else in the function I guess we pop an extra time and that messes up the conditional. Not really sure. This is just some base speculation.
I wanted to debug it in chrome but the stack issue prevented me.
A useful piece of background info is that a Wasm VM must statically validate a program before it even attempts to run it. This is a security feature to guard against running malformed binaries on random websites.
There is a static algorithm that can prove whether all the pushes and pops make sense at every point in the program. The fact that it's static is counter-intuitive. You would naturally expect it to be dynamic.
But this Chrome error means that V8 is refusing to even run the module because it did not pass validation.
I'm sure it's the code gen bug I mentioned. We are emitting the wrong number of pushes and pops due to a bug in the stack machine model.
I can tell you from hard-earned experience that this is NOT going to be a quick fix. It's not a matter of just poking around and trying stuff, because that will just break other edge cases. More likely I'm going to have to scrap the current algorithm and start again with a different one. This will be about my third time doing that.
This time I'd like to try to implementing it exactly as per the algorithm in the standard. I tried to figure that out before but it's designed for a VM, not a code generator, and I ended up going with something more intuitive. But obviously it doesn't work in all cases.
Since there's only one test failing I say we just disable it and create an issue to fix it.
Originally posted by @brian-carroll in #5851 (comment)