#5100: Stack space overflow when using -N2 and not with -N1
-------------------------------+--------------------------------------------
    Reporter:  mitar           |       Owner:              
        Type:  bug             |      Status:  new         
    Priority:  normal          |   Component:  Compiler    
     Version:  7.1             |    Keywords:              
    Testcase:                  |   Blockedby:              
          Os:  Linux           |    Blocking:              
Architecture:  x86_64 (amd64)  |     Failure:  None/Unknown
-------------------------------+--------------------------------------------

Comment(by daniel.is.fischer):

 Definitely a bug.
 {{{
 parListChunk :: Int -> Strategy a -> Strategy [a]
 parListChunk n strat xs =
   concat `fmap` parList (evalList strat) (chunk n xs)

 chunk :: Int -> [a] -> [[a]]
 chunk _ [] = []
 chunk n xs = as : chunk n bs where (as,bs) = splitAt n xs
 }}}
 means that `parListChunk 0 strat xs` evaluates an infinity of empty lists
 in parallel.
 Either parListChunk or chunk should ensure that the chunks are non-empty.
 Since `chunk` is not exported and used only by `parListChunk`, having the
 latter call `chunk (max 1 n) xs` would avoid re-checking the chunksize in
 each recursive step.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to