From 74041e1cc74a53608f6f990a8161c0f77eb2a0e1 Mon Sep 17 00:00:00 2001
From: simonm <unknown>
Date: Fri, 26 Mar 1999 14:54:43 +0000
Subject: [PATCH] [project @ 1999-03-26 14:54:43 by simonm] Fix bug in
 allocGroup() when allocating an entire megablock in one go.

---
 ghc/rts/BlockAlloc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/ghc/rts/BlockAlloc.c b/ghc/rts/BlockAlloc.c
index 7c7dcae24be1..166ef3aea6be 100644
--- a/ghc/rts/BlockAlloc.c
+++ b/ghc/rts/BlockAlloc.c
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: BlockAlloc.c,v 1.4 1999/02/05 16:02:35 simonm Exp $
+ * $Id: BlockAlloc.c,v 1.5 1999/03/26 14:54:43 simonm Exp $
  *
  * (c) The GHC Team 1998-1999
  * 
@@ -88,8 +88,10 @@ allocGroup(nat n)
   initMBlock(mblock);		/* initialise the start fields */
   bd = FIRST_BDESCR(mblock);
   initGroup(n,bd);		/* we know the group will fit */
-  initGroup(BLOCKS_PER_MBLOCK-n, bd+n);
-  freeGroup(bd+n);      	/* add the rest on to the free list */
+  if (n < BLOCKS_PER_MBLOCK) {
+    initGroup(BLOCKS_PER_MBLOCK-n, bd+n);
+    freeGroup(bd+n);      	/* add the rest on to the free list */
+  }
   return bd;
 }
 
-- 
GitLab