Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,867
    • Issues 4,867
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 458
    • Merge requests 458
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #21544
Closed
Open
Created May 10, 2022 by sheaf@sheafMaintainer

GHC 9.4 panic on a representation-polymorphic newtype instance

On GHC 9.4 and HEAD, the following program causes a panic:

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE StandaloneKindSignatures #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UnliftedNewtypes #-}

module T21544 where

import Data.Kind
import GHC.Exts

type N :: forall (r :: RuntimeRep) -> TYPE r -> TYPE r
data family N r a
newtype instance N r a = MkN a

foo :: Int# -> N IntRep Int#
foo = MkN
<no location info>: error:
    panic! (the 'impossible' happened)
  GHC version 9.5.20220503:
        isUnliftedType
  a_aXy :: TYPE r_aXx
  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\Core\Type.hs:2484:7 in ghc:GHC.Core.Type
        isUnliftedType, called at compiler\GHC\Core\Opt\Simplify.hs:2900:5 in ghc:GHC.Core.Opt.Simplify

The program seems to be OK on GHC 9.2 and below.

Edited May 16, 2022 by sheaf
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking