diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
 # Revision history for ghc-debug-common
 
+## 0.7.0.0 -- 2025-05-20
+
+* Fix decoding of BCO bitmap field (fixes a runtime crash in projects which use Template Haskell)
+* Fix build with 9.10 and 9.12
+
 ## 0.6.0.0 -- 2024-04-10
 
 * Support for decoding profiled RTS
diff --git a/ghc-debug-common.cabal b/ghc-debug-common.cabal
--- a/ghc-debug-common.cabal
+++ b/ghc-debug-common.cabal
@@ -1,6 +1,6 @@
 cabal-version:       3.0
 name:                ghc-debug-common
-version:             0.6.0.0
+version:             0.7.0.0
 synopsis:            Connect to a socket created by ghc-debug-stub and analyse
                      the heap of the debuggee program.
 description:         Connect to a socket created by ghc-debug-stub and analyse
@@ -30,13 +30,13 @@
                        array ^>= 0.5,
                        directory ^>= 1.3 ,
                        filepath >= 1.4 && < 1.6,
-                       hashable >= 1.3 && <= 1.5,
+                       hashable >= 1.3 && < 1.6,
                        cpu ^>= 0.1,
                        containers ^>= 0.6,
                        transformers >= 0.5 && < 0.7 ,
                        dom-lt ^>= 0.2,
                        unordered-containers ^>= 0.2,
-                       ghc-debug-convention == 0.6.0.0,
+                       ghc-debug-convention == 0.7.0.0,
                        deepseq >= 1.4
 
   hs-source-dirs:      src
diff --git a/src/GHC/Debug/Decode.hs b/src/GHC/Debug/Decode.hs
--- a/src/GHC/Debug/Decode.hs
+++ b/src/GHC/Debug/Decode.hs
@@ -29,6 +29,8 @@
 import Data.Bits
 import Data.Functor
 import GHC.Debug.Types (getCCS, getIndexTable)
+import qualified Data.Array as A
+import GHC.Stack
 
 decodeClosureHeader :: Version -> Get (Maybe ProfHeaderWithPtr)
 decodeClosureHeader ver = do
@@ -169,7 +171,7 @@
             st_marking
             (StackCont st_sp raw_stack))
 
-decodeFromBS :: RawClosure -> Get (DebugClosure ccs srt pap string s b)
+decodeFromBS :: HasCallStack => RawClosure -> Get (DebugClosure ccs srt pap string s b)
                            -> DebugClosureWithExtra Size ccs srt pap string s b
 decodeFromBS (RawClosure rc) parser =
   case runGetOrFail parser (BSL.fromStrict rc) of
@@ -423,8 +425,22 @@
   bcoptrs <- getClosurePtr
   arity <- getWord32le
   size <- getWord32le
-  bitmap <- replicateM (fromIntegral size) (fromIntegral <$> getWord64le) -- TODO getWord?
+  bitmap <- decodePtrBitmap
   pure (BCOClosure infot prof instrs literals bcoptrs arity size bitmap)
+
+  where
+    unpackWord64 :: Word64 -> [Bool]
+    unpackWord64 w = [ testBit w i | i <- [0..63] ]
+
+    decodePtrBitmap :: Get PtrBitmap
+    decodePtrBitmap = do
+      size <- getWord64le
+      let nWords = fromIntegral ((size + 63) `div` 64)
+      bm_words <- replicateM nWords getWord64le
+      let bits = take (fromIntegral size) (concatMap unpackWord64 bm_words)
+          arr  = A.listArray (0, length bits - 1) bits
+      return (PtrBitmap arr)
+
 
 
 decodeThunkSelector :: Version -> (StgInfoTableWithPtr, RawInfoTable) -> (ClosurePtr, RawClosure) ->  SizedClosure
diff --git a/src/GHC/Debug/Types/Closures.hs b/src/GHC/Debug/Types/Closures.hs
--- a/src/GHC/Debug/Types/Closures.hs
+++ b/src/GHC/Debug/Types/Closures.hs
@@ -388,7 +388,7 @@
                                         --   of byte code objects
         , arity      :: !HalfWord       -- ^ The arity of this BCO
         , size       :: !HalfWord       -- ^ The size of this BCO in words
-        , bitmap     :: ![Word]         -- ^ An StgLargeBitmap describing the
+        , bitmap     :: !PtrBitmap      -- ^ An StgLargeBitmap describing the
                                         --   pointerhood of its args/free vars
         }
 
diff --git a/src/GHC/Debug/Types/Ptr.hs b/src/GHC/Debug/Types/Ptr.hs
--- a/src/GHC/Debug/Types/Ptr.hs
+++ b/src/GHC/Debug/Types/Ptr.hs
@@ -344,7 +344,7 @@
 getInfoTblPtr (RawClosure bs) = runGet_ (isolate 8 get) (BSL.fromStrict bs)
 
 -- | A bitmap that records whether each field of a stack frame is a pointer.
-newtype PtrBitmap = PtrBitmap (A.Array Int Bool) deriving (Show)
+newtype PtrBitmap = PtrBitmap (A.Array Int Bool) deriving (Show, Ord, Eq)
 
 traversePtrBitmap :: Monad m => (Bool -> m a) -> PtrBitmap -> m [a]
 traversePtrBitmap f (PtrBitmap arr) = mapM f (A.elems arr)
