[GHC] #3677: Optimizer creates stack overflow on filtered CAF

GHC trac at galois.com
Fri Nov 20 01:50:23 EST 2009


#3677: Optimizer creates stack overflow on filtered CAF
-------------------------+--------------------------------------------------
    Reporter:  jpet      |       Owner:               
        Type:  bug       |      Status:  new          
    Priority:  normal    |   Milestone:               
   Component:  Compiler  |     Version:  6.10.4       
  Resolution:            |    Keywords:               
          Os:  Windows   |    Testcase:               
Architecture:  x86       |     Failure:  Runtime crash
-------------------------+--------------------------------------------------
Comment (by jpet):

 An even simpler repro:
 {{{
 x :: [Integer]
 x = filter (\n -> n `mod` 10000000 == 0) [0..]
 main = mapM_ print x
 }}}
 Interestingly, 94k seems to be the magic stack threshold again, and in all
 the other simple variations I tried.

 The reason I was using such a small stack in the first place was to try to
 narrow down the stack overflow in the attached program, which overflows
 even an 8M stack. I'm not sure if that program is crashing because of the
 same issue, but I notice that using a replacement 'filter' makes the
 overflow go away:
 {{{
 filter' f (x:xs) = case (f x) of
                     True -> x : (filter' f xs)
                     False -> filter' f xs
 }}}
 As does compiling with -O0. So I suspect it is a variation on the same
 problem.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3677#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list