From 834fcf7de73aeb4a3fa4c88dc995ce1b55b78a93 Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Thu, 12 Jul 2007 16:30:12 +0000 Subject: [PATCH] Fix an array indexing bug in getClosureData (used by :print) --- compiler/ghci/RtClosureInspect.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) -- 1.7.10.4