Skip to content
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

c-writer.cc: represent float consts as integer literals #2389

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

keithw
Copy link
Member

@keithw keithw commented Feb 10, 2024

Fixes #2388 by representing float constants as reinterpretations of an integer. This seems a bit safer than using a decimal %.9g or %.17g literal, and allows us to remove some special-case handling of NaNs, infinity, and negative zero. It does bloat the output a bit (we could shorten f64_reinterpret_i64 to something like f64i which would help a little).

wasm2c (on MSVC) now passes the new proposed testcases (https://github.com/WebAssembly/wabt/actions/runs/7864206734/job/21455684596 vs. https://github.com/WebAssembly/wabt/actions/runs/7864260678/job/21455793263).

@keithw keithw force-pushed the w2c-raw-float-consts branch from c35eaae to 54862c8 Compare February 10, 2024 23:04
@keithw keithw marked this pull request as ready for review February 11, 2024 20:18
@keithw keithw requested a review from sbc100 February 11, 2024 20:18
@keithw keithw force-pushed the w2c-raw-float-consts branch from a82fd4e to bf9bd7b Compare February 23, 2024 16:19
@keithw keithw force-pushed the w2c-raw-float-consts branch from bf9bd7b to 508ee9e Compare March 19, 2024 17:19
@SoniEx2
Copy link
Contributor

SoniEx2 commented May 3, 2024

it would be nice to get this merged...

@SoniEx2
Copy link
Contributor

SoniEx2 commented Sep 16, 2024

presumably this can be closed now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[wasm2c] MSVC miscompiles for certain fp constants
3 participants