Closed j-hui closed 3 years ago
@Rewbert fixed according to your suggestions, and ready for review!
Now, there is one issue in #32 that remains to be addressed. This patch fixes the undefined behavior of signed integer over/underflow in C, but does not do anything to address the undefined behavior in Haskell. It so happens that on our current dev environment, Haskell's Int
type does more or less what we expect it to, but there's not much of a guarantee that will continue to be the case.
To fix that, should I fix the interpreter to perform arithmetic using Integer
and manually perform over/underflow checks + wrapraound? That may incur a noticeable penalty for testing, so I can understand the argument for punting on this and fixing it when it only once we find issues in tests (since this doesn't technically affect the correctness of our generated code).
I'd say skip for now, but leave the issue open :)
Fix for #32 by using C's unsigned integers to represent SSM signed types.
Also includes some reorganization of
SSM.Backend.C
to isolate more of the type-related eccentricities withinSSM.Backend.C.Types
.