Skip to content

Missing cases when printing a closure

The rts has a debug option -Di to print interpreter information, using the function printClosure. This function is missing some cases. For example, given a debug compiler and a file

{-# LANGUAGE UnboxedTuples, MagicHash #-}
module T23142 where

import GHC.IO
import GHC.Exts

main :: IO ()
main = IO (\s -> case newArray# 10# (2 :: Int) s of
                    (# s', a #) -> case unsafeFreezeArray# a s' of
                       (# s'', _ #) -> (# s'', () #))

running ghc --run T23142 +RTS -Di -RTS causes a panic

Entering the interpreter, Sp = 0x42008aee98

stg_ret_p_info
   stk[44] (0x42008aeea0) = 0x4200379110 -- Object 0x4200379110 = 0x4200379110: *** printClosure: unknown type 45 ****
<interactive>: internal error: printClosure 45

I will submit a patch.

Edited by Krzysztof Gogolewski
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information