runtimeRepPrimRep panic when combining UnboxedTuples with -fhpc or {-prof,-fprof-auto}
(Originally observed in !2703 (closed).)
The following program:
{-# LANGUAGE UnboxedTuples #-}
module Bug where
makeUTup2 = (#,#)
Panics on GHC 8.0.2 or later if you compile it with -fhpc
:
$ /opt/ghc/8.8.2/bin/ghc -fhpc -fforce-recomp Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.8.2 for x86_64-unknown-linux):
runtimeRepPrimRep
typePrimRep (a_12 :: TYPE k0_10)
k0_10
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1159:37 in ghc:Outputable
pprPanic, called at compiler/simplStg/RepType.hs:365:5 in ghc:RepType
Or, alternatively, with the combination of -prof
and -fprof-auto
:
$ /opt/ghc/8.8.2/bin/ghc -prof -fprof-auto -fforce-recomp Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.8.2 for x86_64-unknown-linux):
runtimeRepPrimRep
typePrimRep (a_12 :: TYPE k0_10)
k0_10
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1159:37 in ghc:Outputable
pprPanic, called at compiler/simplStg/RepType.hs:365:5 in ghc:RepType
A workaround is to manually eta-expand mkUTup2
:
{-# LANGUAGE UnboxedTuples #-}
module Bug where
makeUTup2 x y = (# x, y #)