GHC can't find weight for edge that should have one
Summary
GHC panics while compiling fetchAndIntArray#
/ fetchOrIntArray#
.
[ 5 of 13] Compiling Data.Bit.MutableTS
ghc: panic! (the 'impossible' happened)
(GHC version 8.8.1 for x86_64-apple-darwin):
Can't find weight for edge that should have one
triple (nQaY, nQwj, sKLs)
updates [(cPjA, nQwR, sL5U), (cPjx, nQwQ, sL5U),
...
(cOPS, nQwl, sKKV), (cOPy, nQwk, sKLs), (nQaY, nQwj, sKLs),
...
(cOEj, nQv2, sKED), (cOEm, nQv1, sKED)]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1159:37 in ghc:Outputable
pprPanic, called at compiler/nativeGen/CFG.hs:423:11 in ghc:CFG
Steps to reproduce
git clone https://github.com/Bodigrim/bitvec.git
git checkout bc84af009921802106239d5e963e00abd1ec7003
stack build
This will fail with an error message, quoted above.
Sorry for such a broad description; at the moment I do not have time to whittle it down. I suspect that the problematic piece is in Data.Bit.InternalTS
:
let W# andMask# = hiMask lenMod
W# orMask# = x .&. loMask lenMod
primitive $ \state ->
let !(# state', _ #) = fetchAndIntArray# mba loIx# (word2Int# andMask#) state in
let !(# state'', _ #) = fetchOrIntArray# mba loIx# (word2Int# orMask#) state' in
(# state'', () #)
Expected behavior
I expect this package to compile successfully.
Environment
- GHC version used: 8.8.1 for x86_64-apple-darwin
It seems to be a regression since GHC 8.6.5, as witnessed by these Travis builds: