summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rts/Sparks.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/rts/Sparks.c b/rts/Sparks.c
index e7273f3ed0..cb3d8d98eb 100644
--- a/rts/Sparks.c
+++ b/rts/Sparks.c
@@ -389,6 +389,12 @@ pruneSparkQueue (evac_fn evac, void *user, Capability *cap)
pool = cap->sparks;
+ // it is possible that top > bottom, indicating an empty pool. We
+ // fix that here; this is only necessary because the loop below
+ // assumes it.
+ if (pool->top > pool->bottom)
+ pool->top = pool->bottom;
+
// Take this opportunity to reset top/bottom modulo the size of
// the array, to avoid overflow. This is only possible because no
// stealing is happening during GC.