Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • 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,827
    • Issues 4,827
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 450
    • Merge requests 450
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #15067

Closed
Open
Created Apr 20, 2018 by Ryan Scott@RyanGlScottMaintainer

When Typeable and unboxed sums collide, GHC panics

This program is enough to send GHC into a tizzy:

{-# LANGUAGE UnboxedSums #-}
module Bug1 where

import Type.Reflection

floopadoop :: TypeRep (# Bool | Int #)
floopadoop = typeRep
$ ghc Bug.hs
[1 of 1] Compiling Bug1             ( Bug.hs, Bug.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 8.4.1 for x86_64-unknown-linux):
        tyConRep
  (#|#)
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
        pprPanic, called at compiler/deSugar/DsBinds.hs:1314:5 in ghc:DsBinds

If you use an unboxed sum data constructor, you can get a different panic:

{-# LANGUAGE PartialTypeSignatures #-}                                                             
{-# LANGUAGE TemplateHaskell #-}                                                                   
{-# LANGUAGE TypeInType #-}                                                                        
{-# LANGUAGE UnboxedSums #-}                                                                       
module Bug2 where

import Language.Haskell.TH
import Type.Reflection

type Fweemp = $(conT (unboxedSumDataName 1 2))

doopafloop :: _ => TypeRep Fweemp
doopafloop = typeRep
$ ghc Bug2.hs
[1 of 1] Compiling Bug2             ( Bug2.hs, Bug2.o )
GHC error in desugarer lookup in Bug2:
  Can't find interface-file declaration for variable $tc'(#_|#)
    Probable cause: bug in .hi-boot file, or inconsistent .hi file
    Use -ddump-if-trace to get an idea of which file caused the error
ghc: panic! (the 'impossible' happened)
  (GHC version 8.4.1 for x86_64-unknown-linux):
        initDs
Trac metadata
Trac field Value
Version 8.2.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking