Skip to content

GHC (compilation mode) crashes

module Main where {

newtype Rec a b = Rec {deRec :: Rec a b -> a};

infixl 1 >|>;
infixl 1 <|<;
(>|>) = Rec;
(<|<) (Rec x) = x;

fix f = (\x -> f (x <|< x)) (Rec (\x -> f (x <|< x)));

factorial = fix (\f x -> if x<=1 then 1 else x*f(x-1));

main = do {
   x <- getLine;
   putStrLn (show (factorial (read x)))
   }

}

GHC crashes with this error:

[1 of 1] Compiling Main             ( /Users/iOne/Documents/Test.hs, /Users/iOne/Documents/Test.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 7.6.3 for x86_64-apple-darwin):
	Simplifier ticks exhausted
    When trying UnfoldingDone a_sMx{v} [lid]
    To increase the limit, use -fsimpl-tick-factor=N (default 100)
    If you need to do this, let GHC HQ know, and what factor you needed
    To see detailed counts use -ddump-simpl-stats
    Total ticks: 7121

(This works fine in GHCi).

Trac metadata
Trac field Value
Version 7.6.3
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