
On Sat, 22 Mar 2014 22:21:42 +0300
Sergei Trofimovich
Hello!
I have noticed the problem in ghc-7.6.3 first when tried to build all haskell userland with -O2 opt level.
It led to amazing bugs!
Here is one of those (highlighting-kate hackage package):
[281 of 452] Compiling Text.Highlighting.Kate.Syntax.Asp ( highlighting-kate-0.5.6.1/Text/Highlighting/Kate/Syntax/Asp.hs, highlighting-kate-0.5.6.1/Text/Highlighting/Kate/Syntax/Asp.o ) stack overflow: use +RTS -K<size> to increase it
How to reproduce it: 1. Download a bundled file (6.6MB): http://code.haskell.org/~slyfox/selfcontained-eater-ghc-7.8-rc2.tar.gz 2. Unpack and run there: ./mk.sh
The script is designed to plug any built ghc version w/o external depends.
Command will fail as: $ ./mk.sh ... [281 of 452] Compiling Text.Highlighting.Kate.Syntax.Asp ( highlighting-kate-0.5.6.1/Text/Highlighting/Kate/Syntax/Asp.hs, highlighting-kate-0.5.6.1/Text/Highlighting/Kate/Syntax/Asp.o ) stack overflow: use +RTS -K<size> to increase it
On ghc-7.6.3 it will progress a bit more: down to 452 file and will crash there similar way.
I've 'cabal unpack'-ed all sources and configured/de-.hsc-ed them manually/added needed -DWhatever / added {-# LANGUAGE CPP #-} around. Nothing else.
It's very hard to shrink such large thing manually down to 2-3 files. Would be cool if ghc (and cabal) would be able to spit something self-sufficient (like 'gcc -i' does) for devs to reproduce.
Adding '-v' shows such log: ... *** Simplifier: Result size of Simplifier iteration=1 = {terms: 21,973, types: 21,838, coercions: 1,842} Result size of Simplifier iteration=2 = {terms: 21,952, types: 21,819, coercions: 1,842} Result size of Simplifier = {terms: 21,950, types: 21,817, coercions: 1,842} *** SpecConstr: Result size of SpecConstr***<CRASH>
Nobody interested? Is it too scary? Such inliner blowups are hard to shrink down from real examples down to toy ones. I could try to but I need a bit of guidance. Maybe you need only an intermediate core step right before an OOM, whatever? Thanks! -- Sergei