Skip to content

GHC panic: Can't serialise IfaceTcTyVar

This bug currently prevents vector from being built with GHC HEAD. Here is a minimized test case:

module Bug where

data Foo a x = Foo x

refoo :: Foo a x -> Foo b x
refoo (Foo x) = Foo x

{-# RULES

"refoo/refoo" forall s.
  refoo (refoo s) = s  #-}

You'll need to compile with optimizations on to trigger this:

$ /opt/ghc/head/bin/ghc -O1 Bug.hs
[1 of 1] Compiling Bug              (.hs -> .o)

Bug.hs:10:1: warning: [-Winline-rule-shadowing]
    Rule "refoo/refoo" may never fire
      because ‘refoo’ might inline first
    Probable fix: add an INLINE[n] or NOINLINE[n] pragma for ‘refoo’

Bug.hs:10:1: warning: [-Winline-rule-shadowing]
    Rule "refoo/refoo" may never fire
      because ‘refoo’ might inline first
    Probable fix: add an INLINE[n] or NOINLINE[n] pragma for ‘refoo’
ghc: panic! (the 'impossible' happened)
  (GHC version 8.1.20161125 for x86_64-unknown-linux):
        Can't serialise IfaceTcTyVar
  a_ary[sk:1]
  Call stack:
      CallStack (from HasCallStack):
        prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1076:58 in ghc:Outputable
        callStackDoc, called at compiler/utils/Outputable.hs:1080:37 in ghc:Outputable
        pprPanic, called at compiler/iface/IfaceType.hs:1331:10 in ghc:IfaceType

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

If I had to guess, this commit ( http://git.haskell.org/ghc.git/commit/5f349fe24066e7b0af85934664e27636d2e84fe5 ) is responsible. Simon, do you know what's going on here?

Trac metadata
Trac field Value
Version 8.1
Type Bug
TypeOfFailure OtherFailure
Priority high
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC simonpj
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information