Skip to content

"Simplifier ticks exhausted" compiling mutually recursive modules with GHC 8.

I encountered the "Simplifier ticks exhausted" error when compiling some code generated by hprotoc in GHC 8.0.1. It works with -O0, but fails with -O1. The code compiles successfully with GHC 7.10, but fails with 8.0.1.

Specifying a larger value for 'simpl-tick-factor' doesn't seem to help. The original code was generated by hprotoc, but a much simplified version is attached.

Here is the output with '-ddump-simpl-stats' enabled:

stack build cycle-test --ghc-options -ddump-simpl-stats
cycle-test-0.1.0.0: configure
Configuring cycle-test-0.1.0.0...
cycle-test-0.1.0.0: build
Preprocessing library cycle-test-0.1.0.0...
[1 of 4] Compiling Thing2[boot]     ( src/Thing2.hs-boot, .stack-work/dist/x86_64-osx/Cabal-1.24.0.0/build/Thing2.o-boot )
[2 of 4] Compiling Thing1           ( src/Thing1.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.0.0/build/Thing1.o )
[3 of 4] Compiling Thing2           ( src/Thing2.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.0.0/build/Thing2.o )
[4 of 4] Compiling Box              ( src/Box.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.0.0/build/Box.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 8.0.1 for x86_64-apple-darwin):
	Simplifier ticks exhausted
  When trying UnfoldingDone $fxEqThing2
  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
  Total ticks:     6442
  
  1681 PreInlineUnconditionally
    280 $dEq_a1AB
    280 ds_a1AC
    280 ds_i28z
    280 ds1_i28A
    279 ds_i29a
    279 ds1_i29b
    1 ds_a1As
    1 ds_d28r
    1 ds_d28s
  280 PostInlineUnconditionally 280 ds1_a1AD
  1120 UnfoldingDone
    280 $fEqMaybe_$c==
    280 $fEqThing1_$c==
    279 $fxEqThing2
    279 $fEqThing2_$c==
    1 $c==_a289
    1 not
  279 RuleFired 279 Class op ==
  2241 BetaReduction
    280 a_a1AA
    280 $dEq_a1AB
    280 ds_a1AC
    280 ds1_a1AD
    280 ds_i28z
    280 ds1_i28A
    279 ds_i29a
    279 ds1_i29b
    1 ds_a1As
    1 ds_d28r
    1 ds_d28s
  1 CaseOfCase 1 wild_a1At
  840 KnownBranch 840 wild_a1At
Trac metadata
Trac field Value
Version 8.0.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