Skip to content

GHC panic related to hybrid-vectors

The following module makes GHC 8.0.1 panic when the fromList declaration is uncommented:

import qualified Data.Vector.Hybrid as VH
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector as V

data SHVector a = SHV {-# UNPACK #-} !Int !(VH.Vector VU.Vector V.Vector (Int, a)) deriving (Eq)

fromList :: Int -> [(Int, a)] -> SHVector a
fromList n ll = SHV n (VH.fromList ll)

Crash message follows:

ghc: panic! (the 'impossible' happened)
  (GHC version 8.0.1 for x86_64-apple-darwin):
	Template variable unbound in rewrite rule
  Variable: sc_shyr
  Rule "SC:$j0"
  Rule bndrs: [sc_shyr, sc_shys, sc_shyt, sg_shyu, sc_shyq]
  LHS args: [sc_shyq,
             (MV
                @ (Mutable Vector)
                @ (Mutable Vector)
                @ (PrimState (ST RealWorld))
                @ (Int, a_aeG1)
                @ Int
                @ a_aeG1
                @~ (<(Int, a_aeG1)>_N
                    :: ((Int, a_aeG1) :: *) ~# ((Int, a_aeG1) :: *))
                sc_shys
                sc_shyt)
             `cast` (sg_shyu
                     :: (MVector
                           (Mutable Vector)
                           (Mutable Vector)
                           (PrimState (ST RealWorld))
                           (Int, a_aeG1) :: *)
                        ~R#
                        (Mutable
                           (Vector Vector Vector)
                           (PrimState (ST RealWorld))
                           (Int, a_aeG1) :: *))]
  Actual args: [sc_shyk,
                wild_ahdD
                `cast` (Sub
                          (Sym (D:R:MutableVector[0] <Vector>_N <Vector>_N)) <PrimState
                                                                                (ST
                                                                                   RealWorld)>_N <(Int,
                                                                                                   a_aeG1)>_N
                        :: (MVector
                              (Mutable Vector)
                              (Mutable Vector)
                              (PrimState (ST RealWorld))
                              (Int, a_aeG1) :: *)
                           ~R#
                           (Mutable
                              (Vector Vector Vector)
                              (PrimState (ST RealWorld))
                              (Int, a_aeG1) :: *))]
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