-
Notifications
You must be signed in to change notification settings - Fork 708
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
[wasm2c] MSVC miscompiles for certain fp constants #2388
Comments
Thanks for reporting this! Can you please test #2389 and see if it fixes the issue for you? There should probably be a test for this situation, ideally eventually upstream in the spec tests. I'm also nervous about MSVC's handling of wasm2c output for conversion instructions given https://github.com/WebAssembly/wabt/blob/main/src/c-writer.cc#L4851 and https://github.com/WebAssembly/wabt/blob/main/src/config.cc#L76 -- we should make sure this is also tested. |
@keithw, PTAL at this spec PR. |
#2389 looks good, no unexpected overhead either
|
it works fine on both endian |
Thanks, good idea. Done in #2389. |
is this still an issue? |
Given WASM
and wasm2c conversion output
there is slight discrepancy in output of different compilers.
Clang & GCC correctly output
-2147483648.000000
MSVC throws warning (error with /sdl) and outputs
2147483648.000000
(notice absence of negative mark)https://godbolt.org/z/MrjMzdeKE
While the conversion output is likely correct according to C spec (at least Clang and GCC are not screaming with -Wall), it's very inconvenient for Windows users to do these fixups manually.
Proposal is to use alternative notation
which makes all tested compilers happy and correct.
https://godbolt.org/z/5sE4adbYd
The text was updated successfully, but these errors were encountered: