GHC does not pass -dstg-lint
When building ghc-8.4 branch with -dstg-lint enabled I got a GHC panic error (please see attachment for full log as it's really big). The error is reproducible on Windows and Debian Linux 64 bit operating systems.
Short error:
"inplace/bin/ghc-stage1" -hisuf hi -osuf o -hcsuf hc -static -O -H64m -Wall -this-unit-id ghc-prim-0.5.2.0 -hide-all-packages -i -ilibraries/ghc-prim/. -ilibraries/ghc-prim/dist-install/build -Ilibraries/ghc-prim/dist-install/build -ilibraries/ghc-prim/dist-install/build/./autogen -Ilibraries/ghc-prim/dist-install/build/./autogen -Ilibraries/ghc-prim/. -optP-include -optPlibraries/ghc-prim/dist-install/build/./autogen/cabal_macros.h -package-id rts -this-unit-id ghc-prim -XHaskell2010 -O -dcore-lint -dstg-lint -dcmm-lint -no-user-package-db -rtsopts -Wno-trustworthy-safe -Wno-deprecated-flags -Wnoncanonical-monad-instances -odir libraries/ghc-prim/dist-install/build -hidir libraries/ghc-prim/dist-install/build -stubdir libraries/ghc-prim/dist-install/build -dynamic-too -c libraries/ghc-prim/./GHC/Types.hs -o libraries/ghc-prim/dist-install/build/GHC/Types.o -dyno libraries/ghc-prim/dist-install/build/GHC/Types.dyn_o
ghc-stage1: panic! (the 'impossible' happened)
(GHC version 8.4.0.20180204 for x86_64-unknown-linux):
*** Stg Lint ErrMsgs: in Unarise ***
<no location info>: warning:
[in body of lambda with binders v_s9Xn :: (a_12 :: k0_10)
~~ (b_13 :: k1_11)]
In some algebraic case alternative, number of arguments doesn't match constructor:
Eq# (arity 1)
[]
<no location info>: warning:
[in body of lambda with binders v_s9Xp :: Coercible a_11 b_12]
In some algebraic case alternative, number of arguments doesn't match constructor:
MkCoercible (arity 1)
[]
*** Offending Program ***
... lots of lines skipped ...
*** End of Offense ***
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/stgSyn/StgLint.hs:68:19 in ghc:StgLint
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
libraries/ghc-prim/ghc.mk:4: recipe for target 'libraries/ghc-prim/dist-install/build/GHC/Types.o' failed
As a side note, it seems that it would be good to enable -dstg-lint
and -dcmm-lint
in devel2
flavour, and possibly some other flavours, or at least on CI, so that they will be tested more frequently.