diff --git a/ghc/runtime/storage/SMstats.lc b/ghc/runtime/storage/SMstats.lc index b10db260f47748b0a18cdc932cd1bb38d135ce84..f67c4e7ae16ddb45b32b9c6af1e5d35166018ef8 100644 --- a/ghc/runtime/storage/SMstats.lc +++ b/ghc/runtime/storage/SMstats.lc @@ -456,6 +456,11 @@ stat_exit(I_ alloc) StgDouble time = usertime(); StgDouble etime = elapsedtime(); + /* avoid divide by zero if time is measured as 0.00 seconds -- SDM */ + if (time == 0.0) time = 0.0001; + if (etime == 0.0) etime = 0.0001; + + if (RTSflags.GcFlags.giveStats) { fprintf(sf, "%8ld\n\n", alloc*sizeof(W_)); }