Opened 2 years ago

Last modified 18 months ago

#13715 new bug

test dynamic-paper for way profasm fails with Simplifier ticks exhausted

Reported by: George Owned by:
Priority: normal Milestone: Research needed
Component: Compiler Version: 8.2.1-rc2
Keywords: simplifier ticks Cc: alpmestan
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash or panic Test Case: dynamic-paper
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


on ghc 8.2.1-rc2 on a mac running the latest Xcode and os

make TEST=dynamic-paper WAY=profasm 
fails with 
ghc-stage2: panic! (the 'impossible' happened)
	  (GHC version for x86_64-apple-darwin):
		Simplifier ticks exhausted
	  When trying UnfoldingDone delta
Call stack:
	      CallStack (from HasCallStack):
		prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1134:58 in ghc:Outputable
		callStackDoc, called at compiler/utils/Outputable.hs:1138:37 in ghc:Outputable
		pprPanic, called at compiler/simplCore/SimplMonad.hs:199:31 in ghc:SimplMonad

it also fails with 1000 ticks
make TEST=dynamic-paper WAY=profasm EXTRA_HC_OPTS='-fsimpl-tick-factor=1000'
so there may be an infinite loop

Attachments (1)

sbug.hs (645 bytes) - added by George 2 years ago.
simplified version (26 lines)

Download all attachments as: .zip

Change History (8)

Changed 2 years ago by George

Attachment: sbug.hs added

simplified version (26 lines)

comment:1 Changed 2 years ago by George

added attachment , simplified version of bug with 26 lines, sbug.hs. The problem can be reproduced with

 ghc -c sbug.hs -O -fprof-auto -prof -static 



still results in the error: Simplifier ticks exhausted.

comment:2 Changed 2 years ago by simonpj

Milestone: Research needed

Aha! Dimitrios and I identified this problem with TypeRep, and wrote about this in Section 7 of Typed reflection in Haskell. This example probably comes straight from that section.

Divergence is absolutely expected here; and the simplifier-tick mechanism correctly prevents the compiler from hanging.

Of course, it would be better to spot the problem and not inline the function, but I don't know how to do that. An interesting research problem.

Meanwhile, since there is no immediate prospect of solving this, and it's not causing any problems in practice, I'll move to milestone "research needed".

comment:3 Changed 2 years ago by George

Is it a bug that it only diverges with "-fprof-auto -auto"? It compiles fine without those options. Yes, the code does come from that paper, as mentioned in a comment in the non-simplified version.

comment:4 Changed 2 years ago by simonpj

It diverges for me (with HEAD) even without profiling. I can't explain why it doesn't for you.

comment:5 Changed 2 years ago by George

I think we get different results because I am using rc2 and you are using HEAD. With the testsuite distributed with rc2 divergence is classified as failure when it seems it should be classified as success.

I'm not the right person to know if it is worth investigating why the behavior changed between rc2 and HEAD.

Last edited 2 years ago by George (previous) (diff)

comment:6 Changed 18 months ago by alpmestan

I'm seeing a failure for profasm as well with a recent checkout of the master branch (commit 8b823f270e), with the simplifier tick limit error. If we increase the limit, we run out of stack space. If we increase the stack size enough with -K, we run out of simplifier ticks again. I'll mark the test as expected broken with the profasm way, but this does look rather suspicious.

comment:7 Changed 18 months ago by alpmestan

Cc: alpmestan added
Note: See TracTickets for help on using tickets.