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

fix printing of Infinites and NaNs #136

Merged
merged 3 commits into from
Feb 27, 2024

Conversation

Ptival
Copy link
Contributor

@Ptival Ptival commented Feb 26, 2024

fixes #135

In a nutshell, the old pretty-printing would output "Infinite" for infinite floating point values, which is not valid LLVM IR. Instead, we must output the hexadecimal representation of the floating point value.

fixes GaloisInc#135

In a nutshell, the old pretty-printing would output "Infinite" for
infinite floating point values, which is not valid LLVM IR.  Instead, we
must output the hexadecimal representation of the floating point value.
@RyanGlScott
Copy link
Collaborator

Thanks! Would you be willing to add a couple of unit tests for this change?

Relatedly, castDoubleToWord64 was only introduced in base-4.11.0.0 (GHC 8.4), so we should bump the lower version bounds on base accordingly in llvm-pretty.cabal.

@kquick
Copy link
Member

kquick commented Feb 27, 2024

There is no round-trip testing here, but adding some round-trip tests to llvm-pretty-bc-parser would be a nice bonus.

@RyanGlScott
Copy link
Collaborator

To be clear, I wasn't imagining a full round-trip test, but rather something like pretty (ValDouble 0x7FF0000000000000p0) == "0x7FF0000000000000".

@Ptival
Copy link
Contributor Author

Ptival commented Feb 27, 2024

How about these tests?

@Ptival Ptival force-pushed the vr/fix-printing-infinite branch from fa5a45c to 25509ff Compare February 27, 2024 00:35
@RyanGlScott RyanGlScott merged commit 1f6118d into GaloisInc:master Feb 27, 2024
1 check passed
@Ptival Ptival deleted the vr/fix-printing-infinite branch March 18, 2024 18:17
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.

Pretty-printing of infinite floating point and NaNs is incorrect/lossy
3 participants