[GHC] #8668: SPECIALIZE silently fails to apply

GHC ghc-devs at haskell.org
Tue Jan 14 03:35:57 UTC 2014


#8668: SPECIALIZE silently fails to apply
----------------------------------+-------------------------------------
       Reporter:  crockeea        |             Owner:
           Type:  bug             |            Status:  new
       Priority:  normal          |         Milestone:
      Component:  Compiler        |           Version:  7.6.2
       Keywords:                  |  Operating System:  Unknown/Multiple
   Architecture:  x86_64 (amd64)  |   Type of failure:  None/Unknown
     Difficulty:  Unknown         |         Test Case:
     Blocked By:                  |          Blocking:
Related Tickets:                  |
----------------------------------+-------------------------------------
 I have a small example where GHC refuses to specialize a call to `(+)`,
 compiling with -O2.
 The two files are  Foo.hs (http://lpaste.net/98464) and Main.hs
 (http://lpaste.net/98342).

 There seem to be two problems:

 1. The active `SPECIALIZE` pragma should be applied, but isn't. This can
 be seen by comparing the core and runtimes of `fcTest` (slow) vs `vtTest`
 (fast). I need this version of the pragma in my real code as the phantom
 type `m` is reified, so I need to specialize the vector code without
 specifying the phantom type.

 2. I can get `fcTest` to run fast if I use the commented-out `SPECIALIZE`
 pragma instead. However, that pragma seems very straightforward to me (all
 types are concrete). The docs indicate that GHC should automatically
 specialize in most cases, why does it not specialize to the commented-out
 signature automatically?

 This problem is also posted here:
 http://stackoverflow.com/questions/21071706/specialization-with-
 constraints

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


More information about the ghc-tickets mailing list