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

Integer overflow in interpreter might be UB #84

Open
j-hui opened this issue Sep 1, 2021 · 1 comment
Open

Integer overflow in interpreter might be UB #84

j-hui opened this issue Sep 1, 2021 · 1 comment
Labels
not-urgent Use this labels for issues that are not urgent.

Comments

@j-hui
Copy link
Collaborator

j-hui commented Sep 1, 2021

Follow on from #32 --- I patched up the generated code to only use C's unsigned ints, for which we can rely on reliably wrapping around on overflow, but the matter of what happens with the Haskell-side interpreter is another matter. In particular, overflow for Int seems to be undefined no matter what. We're not encountering any failed test cases yet, but we should account for this at some point, with some bounds checks, or by converting all arithmetic to take place with Integer and perform the wraparound ourselves.

@j-hui j-hui added the not-urgent Use this labels for issues that are not urgent. label Sep 1, 2021
@j-hui
Copy link
Collaborator Author

j-hui commented Sep 1, 2021

Leaving a note here that overflow of fixed precision integers in Haskell is undefined. In fact, the specific behavior differ within the same platform/compiler implementation: https://rosettacode.org/wiki/Integer_overflow#Haskell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-urgent Use this labels for issues that are not urgent.
Projects
None yet
Development

No branches or pull requests

1 participant