Manifestation:
big = 2147483647
rem (big + 1) big
> 4294967295
Expected the answer to be 1.
(Note that big + 1 doesn't overflow the underlying Word32 -- it's just the rem operation messing up).
The cause is
|
IRem -> emitInstr (typeOf x) $ L.SRem x y [] |
, which unconditionally emits a signed remainder instruction, regardless of whether the Dex type is meant to be signed or unsigned.
Manifestation:
Expected the answer to be 1.
(Note that
big + 1doesn't overflow the underlying Word32 -- it's just theremoperation messing up).The cause is
dex-lang/src/lib/ImpToLLVM.hs
Line 614 in c996e98