Skip to content

Assertion failed with BuildFlavour = devel2

I tried to reproduce random ghc panic we have in our codebase with ghc8 so I decided to compile ghc with debug enabled.

Source file: ghc-8.0.1-src.tar.xz

build.mk changes:

BuildFlavour = devel2
GhcStage1HcOpts = -DDEBUG
GhcStage2HcOpts = -DDEBUG

source:

{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE PolyKinds #-}

module A where

import GHC.Generics

class B f where
  b :: [f a]
  
toEnumDefault :: (B (Rep a)) => Int -> a
toEnumDefault i = let l = b in to

result:

[1 of 1] Compiling A                ( a.hs, a.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 8.0.1 for x86_64-unknown-linux):
        ASSERT failed!
  CallStack (from HasCallStack):
  assertPprPanic, called at compiler/types/TyCoRep.hs:1974:56 in ghc:TyCoRep
  checkValidSubst, called at compiler/types/TyCoRep.hs:2010:17 in ghc:TyCoRep
  substTy, called at compiler/types/TyCoRep.hs:1952:3 in ghc:TyCoRep
  in_scope InScope [a1BD :-> a_a1BD[sk], a1BI :-> k_a1BI[tau:3],
                    a1BJ :-> f_a1BJ[tau:3], a1BL :-> a_a1BL[sk]]
  tenv [a1BD :-> a_a1BL[sk]]
  tenvFVs [a1Bz :-> k_a1Bz[tau:5], a1BL :-> a_a1BL[sk]]
  cenv []
  cenvFVs []
  tys [[f_a1BJ[tau:3] a_a1BD[sk]]]
  cos []

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
Trac metadata
Trac field Value
Version 8.0.1
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