CgUtils.fixStgRegStmt respect register width
This addresses a bug found in the armv7a cross compiler. The platforms word with is 32bit, however the code from time:Data.Time.Clock.System
-- | Convert 'UTCTime' to 'SystemTime', matching zero 'SystemTime' to midnight of 'systemEpochDay' UTC.
utcToSystemTime :: UTCTime -> SystemTime
utcToSystemTime (UTCTime day time) = let
days :: Int64
days = fromIntegral $ diffDays day systemEpochDay
timePicoseconds :: Int64
timePicoseconds = fromIntegral $ diffTimeToPicoseconds time
timeNanoseconds :: Int64
timeNanoseconds = timePicoseconds `div` 1000
timeSeconds :: Int64
nanoseconds :: Int64
(timeSeconds, nanoseconds) =
if timeNanoseconds >= 86400000000000
then (86399, timeNanoseconds - 86399000000000)
else timeNanoseconds `divMod` 1000000000
seconds :: Int64
seconds = days * 86400 + timeSeconds
in MkSystemTime seconds $ fromIntegral nanoseconds
resulted in timeNanoseconds - 86399000000000
becoming a native register offset expression (likely
during some Cmm folding stage, recognising (MO_Add w reg lit)
as reg offset. Subsequently this was
then transformed in GHC.StgToCmm.CgUtils.fixStgRegStmt
resulting in a 32bit addition onto a 64bit
register.