From: Pepe Iborra Date: Thu, 12 Jul 2007 16:30:12 +0000 (+0000) Subject: Fix an array indexing bug in getClosureData (used by :print) X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=834fcf7de73aeb4a3fa4c88dc995ce1b55b78a93 Fix an array indexing bug in getClosureData (used by :print) --- diff --git a/compiler/ghci/RtClosureInspect.hs b/compiler/ghci/RtClosureInspect.hs index e30d1b8..0acc830 100644 --- a/compiler/ghci/RtClosureInspect.hs +++ b/compiler/ghci/RtClosureInspect.hs @@ -161,9 +161,10 @@ getClosureData a = itbl <- peek (Ptr iptr) let tipe = readCType (BCI.tipe itbl) elems = BCI.ptrs itbl - ptrsList = Array 0 (fromIntegral$ elems) ptrs + ptrsList = Array 0 ((fromIntegral elems) - 1) ptrs nptrs_data = [W# (indexWordArray# nptrs i) | I# i <- [0.. fromIntegral (BCI.nptrs itbl)] ] + ASSERT(fromIntegral elems >= 0) return () ptrsList `seq` return (Closure tipe (Ptr iptr) itbl ptrsList nptrs_data)