Opened 3 years ago

Closed 2 years ago

#10105 closed bug (duplicate)

ghc panic Simplifier ticks exhausted when trying UnfoldingDone x_alB

Reported by: dramforever Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.10.1-rc2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: #10372 Differential Rev(s):
Wiki Page:


The following code causes a panic. It's the Y combinator.

module Y where

newtype F a = F { unF :: F a -> a }

y :: (a -> a) -> a
y = \f -> (\x -> x (F x)) (\x -> f (unF x x))
bash$ ~/src/ghc- -c Y.hs
ghc: panic! (the 'impossible' happened)
  (GHC version for x86_64-unknown-linux):
	Simplifier ticks exhausted
  When trying UnfoldingDone x_alB
  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: 4722

Please report this as a GHC bug:

However it works fine in GHCi

bash$ ~/src/ghc- Y.hs
GHCi, version  :? for help
[1 of 1] Compiling Y                ( Y.hs, interpreted )
Ok, modules loaded: Y.
*Y> take 10 (y (1:))

I have tried this code with 7.6.3, 7.8.3 and 7.10.1-rc2. Same result.

At least in 7.10.1-rc2 it doesn't work even with -fsimpl-tick-factor=100000 (that's 105)

Change History (6)

comment:1 Changed 3 years ago by dramforever

In case you didn't get it, I installed 7.10.1-rc2 in prefix ~/src/ghc-

comment:2 Changed 3 years ago by simonpj

Yes indeed: see the user manual]. At least it no longer loops!


comment:3 Changed 3 years ago by dramforever

Oh yes. Actually I knew that before but in this case it just says "panic" rather than looping so I thought it was irrlevant.

Maybe fix the docs?

Also an idea: Maybe we can do positivity analysis on data types just like Agda. We don't have to refuse it, just add a check when compiling functions that deal with it (and maybe a warning?)

comment:4 Changed 3 years ago by Simon Peyton Jones <simonpj@…>

In d2e6a3b5edd687f2a384cd6671a519e222f664b8/ghc:

Improve documentation of infinite inlining bug

This fixes the documentation suggestion in Trac #10105

comment:5 Changed 3 years ago by dramforever

That's great! thanks

comment:6 Changed 2 years ago by thomie

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.