GHC: Ticket #1709: simplifier causes stack overflow in ghc-6.8.0.20070916
http://ghc.haskell.org/trac/ghc/ticket/1709
<p>
In order to reproduce the bug, you'll have to checkout uni:
</p>
<pre class="wiki">svn co https://svn-agbkb.informatik.uni-bremen.de/uni/trunk uni
</pre><p>
install the package HaXml-1.13.2 (to be found as <code>uni/HaXml/HaXml.tgz</code>)
The packages <code>pretty</code> and <code>containers</code> have be added to <code>HaXml.cabal</code>.
</p>
<p>
Within uni call:
</p>
<pre class="wiki">./configure
make packages
</pre><p>
Compilation fails with:
</p>
<pre class="wiki">FileDialog.hs:742:0:
Warning: Definition but no type signature for `deleteFileImg'
Inferred type: deleteFileImg :: IO Image
*** Desugar:
Result size = 5899
*** Simplify:
Result size = 4328
Result size = 4254
Result size = 4254
Result size = 4254
Result size = 4254
*** Specialise:
Result size = 4254
*** Float out (not lambdas, not constants):
Result size = 4906
*** Float inwards:
Result size = 4906
*** Simplify:
*** Deleting temp files:
Warning: deleting non-existent /tmp/ghc23343_0/ghc23343_0.s
*** Deleting temp dirs:
stack overflow: use +RTS -K<size> to increase it
</pre><p>
If I increase with <code>+RTS -K100m</code> compilation exhausts the heap after 18 minutes:
</p>
<pre class="wiki">*** Simplify:
Heap exhausted;
Current maximum heap size is 999997440 bytes (953 Mb);
use `+RTS -M<size>' to increase it.
</pre>en-usGHChttp://ghc.haskell.org/trac/ghc/chrome/site/ghc_logo.png
http://ghc.haskell.org/trac/ghc/ticket/1709
Trac 1.2simonmarMon, 15 Oct 2007 09:24:14 GMTowner, milestone set
http://ghc.haskell.org/trac/ghc/ticket/1709#comment:1
http://ghc.haskell.org/trac/ghc/ticket/1709#comment:1
<ul>
<li><strong>owner</strong>
set to <em>simonpj</em>
</li>
<li><strong>milestone</strong>
set to <em>6.8.1</em>
</li>
</ul>
TicketguestMon, 15 Oct 2007 15:41:16 GMT
http://ghc.haskell.org/trac/ghc/ticket/1709#comment:2
http://ghc.haskell.org/trac/ghc/ticket/1709#comment:2
<p>
The problem also shows up with ghc-6.8.0.20071014, Christian
</p>
TicketsimonpjTue, 16 Oct 2007 13:38:49 GMT
http://ghc.haskell.org/trac/ghc/ticket/1709#comment:3
http://ghc.haskell.org/trac/ghc/ticket/1709#comment:3
<p>
Excellent report thank you.
</p>
<p>
I finally managed to get everything built and thereby reproduced it. What was happening was that a <em>strict</em> function was ending up as a loop-breaker. But in the interface file we said "this is is strict, and here's its worker". So its unfolding was, in effect, exposed, and we got an infinite inlining loop.
</p>
<p>
It's a bizarre case that should not really arise, so I'll pursue that. But meanwhile I have fixed the actual bug.
</p>
<p>
(Ian, it turned out that I fixed it directly in the 6.8 branch. I'll push to the HEAD too myself.)
</p>
<p>
Christian: would you like to check, using tonight's snapshot, that all is well? I'll leave the bug open for now.
</p>
<p>
Simon
</p>
TicketguestTue, 16 Oct 2007 19:11:16 GMTattachment set
http://ghc.haskell.org/trac/ghc/ticket/1709
http://ghc.haskell.org/trac/ghc/ticket/1709
<ul>
<li><strong>attachment</strong>
set to <em>Dist.hs</em>
</li>
</ul>
TicketguestTue, 16 Oct 2007 19:11:56 GMTattachment set
http://ghc.haskell.org/trac/ghc/ticket/1709
http://ghc.haskell.org/trac/ghc/ticket/1709
<ul>
<li><strong>attachment</strong>
set to <em>FileDialog.hs</em>
</li>
</ul>
TicketguestTue, 16 Oct 2007 19:12:12 GMT
http://ghc.haskell.org/trac/ghc/ticket/1709#comment:4
http://ghc.haskell.org/trac/ghc/ticket/1709#comment:4
<p>
Thanks a lot for looking into this! (I'll check it tomorrow.) Meanwhile I've created a boiled down test case:
</p>
<pre class="wiki">ghc --make -O -XFlexibleInstances -fallow-undecidable-instances FileDialog.hs
rm FileDialog.o
ghc --make -O FileDialog.hs
</pre>
TicketguestWed, 17 Oct 2007 10:18:22 GMT
http://ghc.haskell.org/trac/ghc/ticket/1709#comment:5
http://ghc.haskell.org/trac/ghc/ticket/1709#comment:5
<p>
ghc-6.8.0.20071016 is able to compile now all our uni- and hets- sources! Thanks again for taking the trouble of checking out, package modification and installation as well as tracking down the actual problem!
</p>
TicketsimonmarWed, 24 Oct 2007 08:33:23 GMTstatus changed; resolution set
http://ghc.haskell.org/trac/ghc/ticket/1709#comment:6
http://ghc.haskell.org/trac/ghc/ticket/1709#comment:6
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
</ul>
<p>
Simon fixed this:
</p>
<pre class="wiki">Tue Oct 16 06:18:40 PDT 2007 simonpj@microsoft.com
* Fix #1709: do not expose the worker for a loop-breaker
</pre>
Ticket