[GHC] #2224: -fhpc inteferes/prevents rewrite rules from firing

GHC trac at galois.com
Wed Apr 16 20:54:57 EDT 2008


#2224: -fhpc inteferes/prevents rewrite rules from firing
---------------------------+------------------------------------------------
    Reporter:  dons        |       Owner:  andy at galois.com
        Type:  bug         |      Status:  new            
    Priority:  normal      |   Component:  Code Coverage  
     Version:  6.8.2       |    Severity:  normal         
    Keywords:  rules, hpc  |    Testcase:                 
Architecture:  Unknown     |          Os:  Unknown        
---------------------------+------------------------------------------------
 Use case:

 I'm writing tests for rewrite rules, and using HPC to determine if rules
 were fired (and their code exercised). HPC is quite cool here, since it
 lets us see which rules fired, without needing to explicitly export
 functions to test.

 However, -fhpc seems to prevent many rules from firing (likely due to
 ticks getting in the way?)

 For example:

 {{{
 import qualified  Data.ByteString.Char8 as C

 main = print (C.pack "literal")
 }}}

 When compiled normally, triggers a nice rewrite rule:

 {{{
 $ ghc -O2 A.hs -ddump-simpl-stats A.hs -c

     1 ByteString pack/packAddress
 }}}

 Now with -fhpc:

 {{{
 2 RuleFired
     1 unpack
     1 unpack-list
 }}}

 What's the best way to ensure the same code is exercised with and without
 -fhpc here? (I'd quite like to get this working, since rewrite rules
 benefit from testing.)

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


More information about the Glasgow-haskell-bugs mailing list