[GHC] #3437: Optimizer creates space leak on simple code
GHC
trac at galois.com
Tue Aug 18 06:29:37 EDT 2009
#3437: Optimizer creates space leak on simple code
-------------------+--------------------------------------------------------
Reporter: lilac | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 6.10.3 | Severity: normal
Keywords: | Testcase:
Os: Linux | Architecture: x86_64 (amd64)
-------------------+--------------------------------------------------------
The following code should run in constant space:
{{{
{-# LANGUAGE BangPatterns #-}
go (x:xs) !n !k = go xs 0 (n+k+1)
main = print (go (repeat 'x') 0 0 :: Int)
}}}
However, when compiled with -O2, it rapidly eats up the heap. If n and k
are forced to be Int rather than Integer, the problem disappears.
Core for the above with -O2 is here:
http://hpaste.org/fastcgi/hpaste.fcgi/view?id=8268 [[BR]]
The original code from which this was taken is here:
http://hpaste.org/fastcgi/hpaste.fcgi/view?id=8266
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3437>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list