Skip to content

Panic on undersaturated keepAlive#

File:

{-# LANGUAGE MagicHash #-}
module T where
import GHC.Exts
f = keepAlive#

causes a panic:

<no location info>: error:
    panic! (the 'impossible' happened)
  GHC version 9.5.20220429:
	invalid keepAlive# application
  args: [app TYPE: 'Lifted, app TYPE: LiftedRep]
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/GHC/Utils/Panic.hs:182:37 in ghc:GHC.Utils.Panic
        pprPanic, called at compiler/GHC/CoreToStg/Prep.hs:1079:11 in ghc:GHC.CoreToStg.Prep

CorePrep assumes keepAlive# is saturated but this is not checked.

NB: with ghci, this fails Lint, but this is an independent bug #21415 (closed).

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