From: matthewc Date: Tue, 14 May 2002 08:17:38 +0000 (+0000) Subject: [project @ 2002-05-14 08:17:38 by matthewc] X-Git-Tag: Approx_11550_changesets_converted~2037 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=1b3ac6bd8eb887b5961ee00ce49bd66e5dc68e13;p=ghc-hetmet.git [project @ 2002-05-14 08:17:38 by matthewc] Round up GMP allocation requests to a whole number of StgWords (GMP limbs are not necessarily an StgWord in size) --- diff --git a/ghc/rts/Storage.c b/ghc/rts/Storage.c index d0cbb1e..79c3ef7 100644 --- a/ghc/rts/Storage.c +++ b/ghc/rts/Storage.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Storage.c,v 1.65 2002/04/30 09:26:14 simonmar Exp $ + * $Id: Storage.c,v 1.66 2002/05/14 08:17:38 matthewc Exp $ * * (c) The GHC Team, 1998-1999 * @@ -618,10 +618,8 @@ stgAllocForGMP (size_t size_in_bytes) StgArrWords* arr; nat data_size_in_words, total_size_in_words; - /* should be a multiple of sizeof(StgWord) (whole no. of limbs) */ - ASSERT(size_in_bytes % sizeof(W_) == 0); - - data_size_in_words = size_in_bytes / sizeof(W_); + /* round up to a whole number of words */ + data_size_in_words = (size_in_bytes + sizeof(W_) + 1) / sizeof(W_); total_size_in_words = sizeofW(StgArrWords) + data_size_in_words; /* allocate and fill it in. */