[GHC] #5889: -fno-prof-count-entries leads to linking errors

GHC ghc-devs at haskell.org
Sat Jan 13 09:52:59 UTC 2018


#5889: -fno-prof-count-entries leads to linking errors
-------------------------------------+-------------------------------------
        Reporter:  akio              |                Owner:  bgamari
            Type:  bug               |               Status:  new
        Priority:  highest           |            Milestone:  8.4.1
       Component:  Compiler          |              Version:  8.3
      Resolution:                    |             Keywords:
Operating System:  Linux             |         Architecture:  x86_64
                                     |  (amd64)
 Type of failure:  GHC rejects       |            Test Case:
  valid program                      |  profiling/should_compile/T5889
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by osa1):

 > My current understanding is now that the cost-centres are, modulo bugs,
 removed when they aren't wrapping any work. I don't think we have any
 examples here of erroneous cost-centre removal, do you agree?

 Well, this ticket iself is an example of erroneous cost-centre removal,
 isn't it?

 I don't know answers to other questions, but I think the right thing to do
 here is to collect cost-centers in Core instead of STG (maybe in
 coreToStg).

 Because unfoldings are just Core expressions, once we have the code for
 collecting cost centers from unfoldings we can just use the same function
 for the actual program so no need for two functions for collecting cost
 centers (one collects from Core, another one from STG). So once we write
 this we can get rid of cost center collection in STG,
 `stgMassageForProfiling` would just add CAF cost centers.

 On a related note, I found this in the user manual: (8.1.1)

 > Cost centres are just program annotations. When you say -fprof-auto to
 the compiler, it automatically inserts a cost centre annotation around
 every binding not marked INLINE in your program, but you are entirely free
 to add cost centre annotations yourself.

 So GHC by default avoids this bug by not adding SCCs to INLINE functions
 but if you do it yourself you get this bug in some cases.

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


More information about the ghc-tickets mailing list