[GHC] #2224: -fhpc inteferes/prevents rewrite rules from firing
GHC
ghc-devs at haskell.org
Wed Mar 4 17:22:14 UTC 2015
#2224: -fhpc inteferes/prevents rewrite rules from firing
-------------------------------------+-------------------------------------
Reporter: dons | Owner: andy@…
Type: bug | Status: new
Priority: lowest | Milestone: 7.12.1
Component: Code Coverage | Version: 6.8.2
Resolution: | Keywords: rules, hpc
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions:
-------------------------------------+-------------------------------------
Description changed by thomie:
Old description:
> 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-rule-firings A.hs -c
> Rule fired: unpack
> Rule fired: Class op show
> Rule fired: unpack-list
> Rule fired: ByteString packChars/packAddress
> Rule fired: unpack
> Rule fired: Class op show
> Rule fired: unpack-list
> Rule fired: ByteString packChars/packAddres
> }}}
>
> Now with -fhpc:
>
> {{{
> $ ghc -O2 A.hs -ddump-rule-firings A.hs -c -fhpc
> Rule fired: unpack
> Rule fired: Class op show
> Rule fired: unpack-list
> Rule fired: unpack
> Rule fired: Class op show
> Rule fired: 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.)
New description:
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-rule-firings -c
Rule fired: unpack
Rule fired: Class op show
Rule fired: unpack-list
Rule fired: ByteString packChars/packAddress
}}}
Now with -fhpc:
{{{
$ ghc -O2 A.hs -ddump-rule-firings A.hs -c -fhpc
Rule fired: unpack
Rule fired: Class op show
Rule fired: 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://ghc.haskell.org/trac/ghc/ticket/2224#comment:19>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list