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
Unable to compile since 0.26.7 version and above #2682
Unable to compile since 0.26.7 version and above #2682
Comments
That's really strange. Binaryen is crashing, and the error is completely different for me. Even the function that's called by AS at the crash is different (
|
Seems to be limited to optimizing a module with |
Can reproduce in playground. It seems some bug in binaryen. Probably make sense to update their version |
I've locally updated to latest Binaryen. There, I am seeing However, when I try with the above snippet with latest Binaryen, I am seeing |
This comment was marked as outdated.
This comment was marked as outdated.
Is a "memory access out of bounds" error? I reached that error without optimizations, but I'd blame |
This should fix AssemblyScript/assemblyscript#2682 and should work around WebAssembly/binaryen#5648. I don't know. I didn't test this.
Note that this issue was closed automatically via merge. Let's reopen this if it turns out that the workaround doesn't work. |
Whoops! Sorry about that. |
This might also solve #2670 |
Updating to the nightly build of Binaryen, which applies the larger stack size, indeed unblocks #2683. Note, though, that this is merely a workaround, whereas the root cause is in Binaryen. Regarding #2670, see #2683 (comment). Appears that these two issues are only seemingly related, in that both blow the stack, but for different reasons. |
Regarding the snippet above, the stack overflow can be shown in action by applying the following diff: export function final(length: u32): void {
// fold 256 bit state into one single 64 bit value
let result: u64;
if (totalLength > 0) {
result =
rotl(state0, 1) + rotl(state1, 7) + rotl(state2, 12) + rotl(state3, 18);
result = (result ^ processSingle(0, state0)) * Prime1 + Prime4;
result = (result ^ processSingle(0, state1)) * Prime1 + Prime4;
result = (result ^ processSingle(0, state2)) * Prime1 + Prime4;
- result = (result ^ processSingle(0, state3)) * Prime1 + Prime4;
+ // result = (result ^ processSingle(0, state3)) * Prime1 + Prime4; Commenting out that one line, that would otherwise be optimized into a larger sequence of binary expressions, suppresses the issue as the sequence becomes just short enough to not produce the observed effects. Uncommenting manifests the issue. It's not hard to see how similar sequences can be crafted to force overflowing any stack size. |
Bug description
Error:
Steps to reproduce
Input:
AssemblyScript version
v0.26.7
The text was updated successfully, but these errors were encountered: