base/TimerManager: Clamp timer expiration time to maxBound
ClosedPublic

Authored by bgamari on May 21 2018, 3:59 PM.

Details

Summary

Previously we would allow the expiration time to overflow, which in practice
meant that threadDelay maxBound we return far earlier than circa 2500 CE. For
now we fix this by simply clamping to maxBound.

Fixes Trac #15158.

Test Plan

Validate, run T8089

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bgamari created this revision.May 21 2018, 3:59 PM
simonmar added inline comments.May 22 2018, 3:36 AM
libraries/base/GHC/Event/TimerManager.hs
217

"need"

221

This might overflow, no?

bgamari added inline comments.May 22 2018, 8:28 AM
libraries/base/GHC/Event/TimerManager.hs
221

Of dear, yes, of course.

bgamari updated this revision to Diff 16500.May 22 2018, 8:36 AM

Fix another overflow

Is it possible to make a test for this?

libraries/base/GHC/Event/TimerManager.hs
219

Does that compile with /? I thought it would need quot

bgamari updated this revision to Diff 16507.May 22 2018, 6:38 PM

Finally fix it

bgamari updated this revision to Diff 16509.May 22 2018, 8:46 PM

Mark test as not-broken

This revision is now accepted and ready to land.May 23 2018, 4:12 AM
This revision was automatically updated to reflect the committed changes.