Skip to content

[ghc-9.2.3] ghc: panic! (the 'impossible' happened) - Can't find slot

Summary

I get ghc: panic! (the 'impossible' happened) when I compile my package.

Steps to reproduce

Minimal reproducer:

  1. mkdir primitive-unlifted-ghc-bug; cd primitive-unlifted-ghc-bug
  2. Create cabal.project
$ cat cabal.project
packages: ./
source-repository-package
  type: git
  location: https://github.com/haskell-primitive/primitive-unlifted.git
  tag: 9b16b79318cbe294d3fdf730b8bd0e4191bf422e
  1. Create dot cabal file
cat primitive-unlifted-ghc-bug.cabal 
cabal-version:      3.6
name:               primitive-unlifted-ghc-bug
version:            0.1.0.0
author:             Jan Synáček
maintainer:         your.email@mmm.com

executable primitive-unlifted-ghc-bug
    main-is:          Main.hs
    build-depends:    base ^>=4.16.2.0
                    , primitive-unlifted == 1.0.0.0
    hs-source-dirs:   app
    default-language: Haskell2010
  1. Use simple main.
$ cat app/Main.hs 
module Main where

main :: IO ()
main = putStrLn "Hello, Haskell!"
  1. Build the package
$ cabal build -w ghc-9.2.3
...
[ 4 of 19] Compiling Data.Primitive.Unlifted.MVar.Primops ( src/Data/Primitive/Unlifted/MVar/Primops.hs, dist/build/Data/Primitive/Unlifted/MVar/Primops.o, dist/build/Data/Primitive/Unlifted/MVar/Primops.dyn_o )
ghc: panic! (the 'impossible' happened)
  (GHC version 9.2.3:
	findSlot
  Can't find slot
  [PtrUnliftedSlot]
  [PtrLiftedSlot]
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/GHC/Utils/Panic.hs:181:37 in ghc:GHC.Utils.Panic
        pprPanic, called at compiler/GHC/Types/RepType.hs:220:9 in ghc:GHC.Types.RepType

Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug

Expected behavior

No panics.

Environment

  • GHC version used: 9.2.3 installed with ghcup.
  • cabal-3.6.3.0

Optional:

  • Operating System: Archlinux
  • System Architecture: x86-64
Edited by Andreas Klebinger
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information