id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
2797,ghci stack overflows when ghc does not,TristanAllwood,igloo,"Happens with today's HEAD and 6.10.1

I appreciate I am playing a little fast and loose by using unsafePerformIO.

{{{
module Main where

import System.IO.Unsafe

main :: IO ()
main = do
  bar [] 5000000 `seq` return ()

bar :: [()] -> Int -> Int
bar stk 0 = error $ show stk
bar stk n = stk `seq` bar (push stk) (n-1)

push :: [()] -> [()]
push stk = unsafePerformIO . return $ take 2 (():stk)
}}}

{{{
$ ~/ghc/ghc/ghc/stage2-inplace/ghc -O0 --make -o GT2 ghciTest2.hs 
[1 of 1] Compiling Main             ( ghciTest2.hs, ghciTest2.o )
Linking GT2.exe ...

t-trallw@MSRC-1326435 ~/ghc/ghc-Stack-Tests
$ ./GT2.exe +RTS -k0.01k -K0.01k
GT2.exe: [(),()]

t-trallw@MSRC-1326435 ~/ghc/ghc-Stack-Tests
$ rm *.o *.exe *.hi ; ~/ghc/ghc/ghc/stage2-inplace/ghc -e 'main' ghciTest2.hs +RTS -K40M
Stack space overflow: current size 40000000 bytes.
Use `+RTS -Ksize' to increase it.
}}}

Using {{{-K400M}}} ghci does get there.",merge,closed,normal,6.12.2,GHCi,6.11,fixed,,fasta,Unknown/Multiple,Unknown/Multiple,Runtime performance bug,Unknown,,,,
