-
Notifications
You must be signed in to change notification settings - Fork 758
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
asm2wasm frem miscompilation leads to wasm validation error #1105
Comments
Looks like neither f32.rem nor f64.rem are WebAssembly instructions, which means binaryen will try to replace it with a f64-rem function that it provides itself. Seems like there's no f32-rem. This seems to be the code that does the replacement: Lines 1822 to 1838 in e865f2f
Seems like it just needs a check that promotes the f32 arguments to f64, which seems to be done with: curr->operands[i] = parent->builder.makeUnary(PromoteFloat32, curr->operands[i]); Interestingly, this is part of visitCallImport which seems to be the function that fixes calls to imports. So I feel like that should've been fixing the arguments, but it maybe didn't get called?! https://github.com/WebAssembly/binaryen/blob/master/src/asm2wasm.h#L1350 |
Yeah, that's it, thanks. I think this was missed since clang doesn't end up emitting it, but looks like rust can. Fix is in #1106. |
Fixed by that PR. |
Sources:
invoking
asm2wasm
on following input:will lead to wasm validation error:
The text was updated successfully, but these errors were encountered: