[GHC] #680: SCC mis-accounting

GHC trac at galois.com
Thu Feb 2 02:24:22 EST 2006


#680: SCC mis-accounting
-----------------------------------+----------------------------------------
    Reporter:  andrew at pimlott.net  |        Owner:         
        Type:  bug                 |       Status:  new    
    Priority:  normal              |    Milestone:         
   Component:  Profiling           |      Version:  6.4.1  
    Severity:  normal              |     Keywords:         
          Os:  Unknown             |   Difficulty:  Unknown
Architecture:  Unknown             |  
-----------------------------------+----------------------------------------
The profiles sometimes charges to the wrong account.  In this example:
 {{{
 foo :: (() -> () -> [()] -> [()]) -> () -> [()] -> [()]
 foo k =
   \_ xs -> concatMap ($ [head xs]) [bar]
  where
   bar =
     let k' = k undefined undefined
     in  \xs ->
           let k'' = [k' xs]
           in  (() : (foldr1 (>>) k''))

 k = foo (\_ -> k)
 --k a = foo (\_ -> k) a
 r = k undefined [] !! 4000
 main = print r
 }}}
 almost all of the time, allocations, and heap retention are charged
 to k.  However, if you use the commented definition of k, the changes
 switch to foo, as expected.  This can be tested by running
 {{{
 ghc --make -prof -auto-all Logic.hs && ./a.out +RTS -hc && hp2ps -c
 a.out.hp
 }}}
 and watching the pretty graph change.

 This is using ghc 6.4.1 from Debian unstable.  More background at
 http://haskell.org/pipermail/haskell-cafe/2006-February/014139.html

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


More information about the Glasgow-haskell-bugs mailing list