Opened 3 years ago

Closed 3 years ago

#8833 closed bug (duplicate)

GHC (compilation mode) crashes

Reported by: guest Owned by:
Priority: normal Milestone:
Component: Compiler Version:
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: x86_64 (amd64)
Type of failure: Compile-time crash Test Case:
Blocked By: Blocking:
Related Tickets: #3872, #5400, #5448, #5722, #7057, #7369 Differential Rev(s):
Wiki Page:


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).

Attachments (1)

Test.hs (319 bytes) - added by guest 3 years ago.
The program that caused the error

Download all attachments as: .zip

Change History (5)

Changed 3 years ago by guest

Attachment: Test.hs added

The program that caused the error

comment:1 Changed 3 years ago by goldfire


I've confirmed that this bug still happens with 7.8.1 RC 2.

comment:2 Changed 3 years ago by thoughtpolice

(Apparently I forgot to post my comment on this one. Urgh.)

After talking with Simon, we don't think this is a bug. This program probably won't compile on any GHC version (and Simon verified it on 7.4) as well - this is a variant of a known problem I believe, where you can trick the inliner into looping by encoding recursion into a data type:

It will of course work in GHCi - but that's because it doesn't use the inliner.

Unless I'm missing something here, I believe this is a WONTFIX.

comment:3 Changed 3 years ago by simonpj

Indeed, it's a dup of #3872, #5400, #5448, #5722, #7057, #7369. Nevertheless, good to have another example


comment:4 Changed 3 years ago by thoughtpolice

Milestone: 7.8.1
Resolution: duplicate
Status: newclosed
Version: 7.8.1-rc2
Note: See TracTickets for help on using tickets.