[GHC] #13080: Constant values are not floated out of the loop

GHC ghc-devs at haskell.org
Sat Jan 7 13:57:52 UTC 2017


#13080: Constant values are not floated out of the loop
-------------------------------------+-------------------------------------
           Reporter:  Feuerbach      |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 See this stackoverflow post: http://stackoverflow.com/a/41521876/110081

 Basically, the following program leaks memory on ghc 7.10.3 and ghc 8.0.1.

 {{{#!hs
 import Control.Monad (forever)

 main :: IO ()
 main = worker

 {-# NOINLINE worker #-}
 worker :: (Monad m) => m ()
 worker = forever $ poll ()

 poll :: (Monad m) => () -> m a
 poll action = do
     return ()
     poll action
 }}}

 Could ghc do better there?

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


More information about the ghc-tickets mailing list