Skip to content

Compiler panic with SPECIALIZE pragma on function from imported module

Consider the following two modules:

module Test1 where

class C a where c :: a -> a

{-# INLINE f #-}
f :: (C a) => a
f = c f
module Test2 where

import Test1

data D

instance C D

{-# SPECIALIZE f :: D #-}

ghc-7.0.1 invoked with -O Test2 results in

[1 of 2] Compiling Test1            ( Test1.hs, Test1.o )
[2 of 2] Compiling Test2            ( Test2.hs, Test2.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 7.0.1 for i386-unknown-mingw32):
        dsImpSpecs main:Test1.f{v r2} [gid]

This is a highly simplified example of a desired rewrite rule in the generic programming library Multirec. Note that there is no problem if the code is all in the same module.

Trac metadata
Trac field Value
Version 7.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC jpm@cs.uu.nl
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information