-
Notifications
You must be signed in to change notification settings - Fork 786
asm2wasm: incorrect translation of switch for big 64 bit values #1109
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
Comments
Thanks for reporting, proposed fix in #1111. This makes it check if the offset condition has any upper bits, in which case it branches to the default. Does the output look ok to you?
|
Looks good to me. However, I would like to validate this PR on the original case. But I'm not sure how can I build emscripten with binaryen on #1111 branch... |
To validate, check out and build binaryen manually. Then set the env var |
Is there any way to pass this to rustc? |
Hmm, I don't know how rustc works. But if the env var fails, you can edit the |
Yep, that worked, thank you! |
Thanks for confirming, merged. |
Source: rust-lang/rust#42630 (comment)
For example:
gets translated to
IIUC,
i32.wrap/i64
takes i64 and trunctates it to only lower 32 bits. So in this case, result ofi32.wrap/i64
will be0
, meaning first switch-case will be taken and then program aborted.The text was updated successfully, but these errors were encountered: