diff options
author | Ian Lynagh <igloo@earth.li> | 2009-07-30 10:53:51 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2009-07-30 10:53:51 +0000 |
commit | b7fe69ecd3cff467bb33913c9f36d66f2cf8ac4a (patch) | |
tree | b8176ca9f4e83f3c558ead147e79c4d9d6928014 /compiler/ghci | |
parent | b0046dd679244886fdc62e5cc2a73128d2e018bb (diff) | |
download | haskell-b7fe69ecd3cff467bb33913c9f36d66f2cf8ac4a.tar.gz |
Fix space problems in ghci
We were making arrays with range (0, n-1) which is bad if n == 0 now
that we are using Word types.
Diffstat (limited to 'compiler/ghci')
-rw-r--r-- | compiler/ghci/ByteCodeLink.lhs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/ghci/ByteCodeLink.lhs b/compiler/ghci/ByteCodeLink.lhs index 11d4022196..f0ab8cf2e5 100644 --- a/compiler/ghci/ByteCodeLink.lhs +++ b/compiler/ghci/ByteCodeLink.lhs @@ -124,7 +124,9 @@ linkBCO' ie ce (UnlinkedBCO nm arity insns_barr bitmap literalsSS ptrsSS) let !ptrs_parr = case ptrs_arr of Array _lo _hi _n parr -> parr - literals_arr = listArray (0, n_literals-1) linked_literals + litRange = if n_literals > 0 then (0, n_literals-1) + else (1, 0) + literals_arr = listArray litRange linked_literals :: UArray Word16 Word !literals_barr = case literals_arr of UArray _lo _hi _n barr -> barr @@ -136,7 +138,8 @@ linkBCO' ie ce (UnlinkedBCO nm arity insns_barr bitmap literalsSS ptrsSS) -- we recursively link any sub-BCOs while making the ptrs array mkPtrsArray :: ItblEnv -> ClosureEnv -> Word16 -> [BCOPtr] -> IO (Array Word16 HValue) mkPtrsArray ie ce n_ptrs ptrs = do - marr <- newArray_ (0, n_ptrs-1) + let ptrRange = if n_ptrs > 0 then (0, n_ptrs-1) else (1, 0) + marr <- newArray_ ptrRange let fill (BCOPtrName n) i = do ptr <- lookupName ce n |