Skip to content

Case-inspecting unboxed unit causes codegen crash

Here is a minimal test case:

foo :: (() -> (# #)) -> Int
foo f = case f () of (# #) -> 5

GHC crashes with:

ghc.exe: panic! (the 'impossible' happened)
  (GHC version 7.6.1 for i386-unknown-mingw32):
        compiler\codeGen\CgCase.lhs:572:15-61: Irrefutable pattern failed for pattern ((CoreSyn.DEFAULT,
                                        deflt_absC) : others)

Here is the actual function (simplified) that triggered the bug:

foo :: [a] -> Int
foo xs = foldl' (flip seq) () xs `seq` 5
Trac metadata
Trac field Value
Version 7.6.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