diff options
author | Ian Lynagh <igloo@earth.li> | 2008-04-26 18:43:55 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2008-04-26 18:43:55 +0000 |
commit | 2d0131da643d1f8da16816c672b7e29defcf2a2d (patch) | |
tree | 57daefee41e5d14046dc0b6d0c878bc82f5e1893 /rts/PrimOps.cmm | |
parent | b84b5969798530dbf5be9b8bb795b77e5dfbf042 (diff) | |
download | haskell-2d0131da643d1f8da16816c672b7e29defcf2a2d.tar.gz |
Fix a division-by-zero when +RTS -V0 is given
In delayzh_fast we act as if tickInterval was 50, not 0.
Diffstat (limited to 'rts/PrimOps.cmm')
-rw-r--r-- | rts/PrimOps.cmm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm index 6c3593e4a4..c3ab788ba2 100644 --- a/rts/PrimOps.cmm +++ b/rts/PrimOps.cmm @@ -2118,7 +2118,11 @@ delayzh_fast W_ time; W_ divisor; (time) = foreign "C" getourtimeofday() [R1]; - divisor = TO_W_(RtsFlags_MiscFlags_tickInterval(RtsFlags))*1000; + divisor = TO_W_(RtsFlags_MiscFlags_tickInterval(RtsFlags)); + if (divisor == 0) { + divisor = 50; + } + divisor = divisor * 1000; target = ((R1 + divisor - 1) / divisor) /* divide rounding up */ + time + 1; /* Add 1 as getourtimeofday rounds down */ StgTSO_block_info(CurrentTSO) = target; |