#7110: Stack overflow when compiling with optimizations
------------------------------+---------------------------------------------
 Reporter:  EyalLotem         |          Owner:                  
     Type:  bug               |         Status:  new             
 Priority:  normal            |      Component:  Compiler        
  Version:  7.4.1             |       Keywords:                  
       Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
  Failure:  Runtime crash     |       Testcase:                  
Blockedby:                    |       Blocking:                  
  Related:                    |  
------------------------------+---------------------------------------------
 This program:
 {{{
 import Control.Exception (evaluate)

 main :: IO ()
 main = do
   let smap = concat . replicate 300 $ concat [" ", replicate 2027 '#', "
 \n"]
   evaluate $ fst (stringReader 1 smap)

 stringReader :: Int -> String -> ((), String)
 stringReader 1 ('\r':'\n':_) = ((), "")
 stringReader _ ('\n':cs) = stringReader 1 cs -- unix
 stringReader x (_:cs) = stringReader x cs
 stringReader _ _ = ((), "")
 }}}

 Causes a stack overflow when compiled with -O2, and no problem when
 compiled without optimizations.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to