CgCase fails with strict data/functions
The following code results in a ghc panic when compiled with -O or above:
-- Test.hs
module Test where
import Data.List (foldl')
data SPair = SPair { pX, pY :: Double } deriving (Eq,Show)
data AList = AList
{ pairs :: [SPair] } deriving Show
rnf' :: AList -> ()
rnf' aList = foldl' (flip seq) () (pairs aList) `seq` ()
{- -- this works
rnf' :: AList -> ()
rnf' aList = foldl (flip seq) () (pairs aList) `seq` ()
-}
The resulting error is
{{{ $ ghc -O Test.hs [1 of 1] Compiling Test ( Test.hs, Test.o ) ghc: panic! (the 'impossible' happened)
(GHC version 7.6.1 for x86_64-unknown-linux):
compiler/codeGen/CgCase.lhs:572:15-61: Irrefutable pattern failed for pattern ((CoreSyn.DEFAULT,
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 |