#4276: -O0 runs in constant space, -O1 and -O2 don't
--------------------------------------+-------------------------------------
  Reporter:  guest                    |          Owner:  igloo                  
      Type:  bug                      |         Status:  closed                 
  Priority:  normal                   |      Milestone:  7.2.1                  
 Component:  Compiler                 |        Version:  6.12.1                 
Resolution:  duplicate                |       Keywords:  optimization space leak
  Testcase:                           |      Blockedby:                         
Difficulty:                           |             Os:  Windows                
  Blocking:                           |   Architecture:  x86                    
   Failure:  Runtime performance bug  |  
--------------------------------------+-------------------------------------
Changes (by igloo):

  * status:  new => closed
  * resolution:  => duplicate


Comment:

 This looks like another full-laziness issue, with [0..] being shared.
 If you compile with `-O1 -fno-full-laziness` then space usage matches
 `-O0`.

 Here's a smaller program:
 {{{
 module Main (main) where

 import Data.List

 sum' :: [Double] -> Double
 sum' xs = foldl' (+) 0 xs

 go :: Double -> [Double]
 go w = sum' xs : go (w / 2)
     where xs = takeWhile (<= 23) [k*w | k <- [0..]]

 main :: IO ()
 main = mapM_ print $ take 20 $ go 22
 }}}

 Closing as a duplicate of #917.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4276#comment:4>
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