<div dir="ltr">I think this has been mentioned before but it's probably not widely known: if you compile GHC profiled (that is, enable GhcProfiled=YES in your mk/<a href="http://build.mk">build.mk</a>), then every panic comes with a stack trace.  Here's one I just saw:<div><br></div><div><div>ghc-stage2: panic! (the 'impossible' happened)</div><div>  (GHC version 8.1.20161206 for x86_64-unknown-linux):</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span>Ix{Int}.index: Index (65536) out of range ((0,28))</div><div>CallStack (from -prof):</div><div>  HscTypes.bin_fixities (compiler/main/HscTypes.hs:1050:51-56)</div><div>  HscMain.checkOldIface (compiler/main/HscMain.hs:(586,20)-(587,60))</div><div>  HscMain.hscIncrementalFrontend (compiler/main/HscMain.hs:(556,1)-(618,81))</div><div>  HscMain.hscIncrementalCompile (compiler/main/HscMain.hs:(644,1)-(699,32))</div><div>  GHC.withCleanupSession (compiler/main/GHC.hs:(464,1)-(473,27))</div><div>  GHC.runGhc (compiler/main/GHC.hs:(439,1)-(444,26))</div><div>  GHC.defaultErrorHandler (compiler/main/GHC.hs:(379,1)-(411,7))</div></div><div><br></div><div>To get more detail in the stack trace you need to add </div><div><br></div><div>  GhcStage2HcOpts += -fprof-auto-top</div><div><br></div><div>Or -fprof-auto, depending on how much detail you want.</div><div><br></div><div>Cheers</div><div>Simon</div></div>