Skip to content

GHC panics with dsImpSpecs on SPECIALISE pragma with -fhpc enabled

Minimal example code: https://github.com/nh2/ghc-omit-interface-pragmas-dsImpSpecs-bug/

I'm encountering a problem that prevents me from using Haskell program coverage on a code base, getting a GHC panic referring to dsImpSpecs.

This looks pretty much like this old bug: #4870 (closed)

I checked that it happens on GHC 7.8.4 and GHC 7.10.1.


The problem happens when I run cabal build --ghc-options "-fhpc", giving me

Package has never been configured. Configuring with default flags. If this
fails, please run configure manually.
Resolving dependencies...
Configuring ghc-omit-interface-pragmas-dsImpSpecs-bug-0.1.0.0...
Building ghc-omit-interface-pragmas-dsImpSpecs-bug-0.1.0.0...
Preprocessing library ghc-omit-interface-pragmas-dsImpSpecs-bug-0.1.0.0...
[1 of 2] Compiling A                ( src/A.hs, dist/build/A.o )
[2 of 2] Compiling B                ( src/B.hs, dist/build/B.o )

src/B.hs:5:1: Warning:
    SPECIALISE pragma for non-overloaded function ‘myfun’
ghc: panic! (the 'impossible' happened)
  (GHC version 7.8.4 for x86_64-unknown-linux):
    dsImpSpecs
    ghc-omit-interface-pragmas-dsImpSpecs-bug-0.1.0.0:A.myfun{v rpu} [gid]

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.8.4
$ cabal --version
cabal-install version 1.18.0.8
using version 1.18.1.5 of the Cabal library

This doesn't happen when I compile directly with ghc --make:

$ cd src && ghc --make -fhpc -fomit-interface-pragmas B.hs -Wall
[1 of 2] Compiling A                ( A.hs, A.o )
[2 of 2] Compiling B                ( B.hs, B.o )

So running cabal with -v, I see that the problem happens in:

/home/niklas/opt/ghc-7.8/bin/ghc --make -fbuilding-cabal-package -O -static -dynamic-too -dynosuf dyn_o -dynhisuf dyn_hi -outputdir dist/build -odir dist/build -hidir dist/build -stubdir dist/build -i -idist/build -isrc -idist/build/autogen -Idist/build/autogen -Idist/build -optP-include -optPdist/build/autogen/cabal_macros.h -package-name ghc-omit-interface-pragmas-dsImpSpecs-bug-0.1.0.0 -hide-all-packages -package-db dist/package.conf.inplace -package-id base-4.7.0.2-bfd89587617e381ae01b8dd7b6c7f1c1 -XHaskell98 B A -Wall -fhpc
[1 of 2] Compiling A                ( src/A.hs, dist/build/A.o )
[2 of 2] Compiling B                ( src/B.hs, dist/build/B.o )

src/B.hs:5:1: Warning:
    SPECIALISE pragma for non-overloaded function ‘myfun’
ghc: panic! (the 'impossible' happened)
  (GHC version 7.8.4 for x86_64-unknown-linux):
	dsImpSpecs
    ghc-omit-interface-pragmas-dsImpSpecs-bug-0.1.0.0:A.myfun{v rpu} [gid]

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

So there it be some flag that cabal passes to GHC that makes this GHC crash appear.

Nevertheless, it's a panic, so I guess it's a bug in GHC.

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