Stack overflow when compiling with optimizations
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.
Trac metadata
Trac field | Value |
---|---|
Version | 7.4.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |