GHC panic on rebuild (idInfo r_XsTP)
Steps to reproduce
git clone 'https://github.com/cocreature/llvm-general.git' -b ghc-panic cd llvm-general cabal new-build llvm-general curl -s https://gist.githubusercontent.com/cocreature/c6807d7906756a2d58b8fe774141bfef/raw/2b70a8cc1a1aed7a44b418fba04e8df4818c1237/out.patch > out.patch git apply out.patch cabal new-build llvm-general
The patch just adds a newline somewhere to create a rebuild. I’ve seen this panic for completely different changes (all in this project) so I don’t think the change matters. I’ve also seen this panic with stack, cabal new-build and cabal build (using sandboxes).
In order, the following will be built (use -v for more details): llvm-general-22.214.171.124 Preprocessing library llvm-general-126.96.36.199... [84 of 92] Compiling LLVM.General.Internal.Module ( src/LLVM/General/Internal/Module.hs, /home/moritz/tmp/llvm-general/dist-newstyle/build/llvm-general-188.8.131.52/build/LLVM/General/Internal/Module.o ) [85 of 92] Compiling LLVM.General.Module ( src/LLVM/General/Module.hs, /home/moritz/tmp/llvm-general/dist-newstyle/build/llvm-general-184.108.40.206/build/LLVM/General/Module.o ) [LLVM.General.Internal.Module changed] [89 of 92] Compiling LLVM.General.Internal.PassManager ( src/LLVM/General/Internal/PassManager.hs, /home/moritz/tmp/llvm-general/dist-newstyle/build/llvm-general-220.127.116.11/build/LLVM/General/Internal/PassManager.o ) [TH] ghc: panic! (the 'impossible' happened) (GHC version 8.0.1 for x86_64-unknown-linux): idInfo r_XsTP Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
In this case this can be resolved by running cabal new-build again. However I’ve also had cases where this didn’t fix it and I had to blow away dist-newstyle. I haven’t yet managed to find a reproducible testcase for the latter. Matthew Pickering mentioned that he encountered this (or a similar) bug while building GHC. I tried core-lint but that didn’t help.