-
Notifications
You must be signed in to change notification settings - Fork 696
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: Fix f64 harness #2331
wasm2c: Fix f64 harness #2331
Conversation
5ce3ed6
to
38aab17
Compare
Hmm, it looks like it was changed to |
In C, (We also note that our second person pronouns are "it instead of you".) |
For what it's worth, the relevant code in |
Is this fix only needed on plaforms where long double and no the same as double? On what platform did you discover the issue? |
we first noticed the issue on both linux-x64 and linux-s390x (via qemu). we do strongly believe this is the correct way of doing it. passing long double to a format string expecting double is UB. |
I understand, I'm just trying to figure exactly who is effected and how. |
it affects our ability to understand test failures. that's all this fix does, makes it possible for someone to look at the test output and figure out what went wrong, as opposed to guessing what went wrong. |
Windows now treats long double as equivalent to double. It is possible the change was just to enforce the use of the full double-precision floating point type handling. It should be noted that explicitly using
|
We will further note that f64 has always been double, never long double, even on Windows, as per https://github.com/WebAssembly/wabt/blob/main/src/template/wasm2c.top.h . Everything appears to point to this being a mistake, or a misunderstanding of the Windows types or something. Also, CI passes with this change, even on Windows. |
lgtm Please bear with me for for one more question though. Note I don't doubt the value of this change or the likelihood that this was a mistake/oversight. Do you know why none of the existing test outputs changed here? Do we not have existing tests that contain f64 outputs and with f64 assertion failures? i.e. why do we need a new test here, why isn't this covered by existing spec tests? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm % last question
This is a test harness test. The spec tests expect assertions to, well, pass, while here we're testing what happens when an assertion doesn't pass. (The spec tests sometimes assert that a function traps, but that's different from an assertion failure.) When passed into a module, the long double was narrowed into a double, so anything passing through wasm was a double. But due to the way the test harness macros are set up it would still pass these long double literals as long double into the printf machinery - which was expecting a double. |
Thanks, that was what I was missing. I was expecting to see some change to the output of expected failures in the spec tests .. but this change only effects unexpected failures. lgtm |
(updating so this will automerge) |
38aab17
to
8bba3b8
Compare
Old output:
(Note how wrong this output is!)