Skip to content

HEAD panics with toIfaceCoercionX when dumping core.

I added dump flags to a file on head:

diff --git a/compiler/GHC/Tc/Gen/Head.hs b/compiler/GHC/Tc/Gen/Head.hs
index feb984fc26..7e227653d0 100644
--- a/compiler/GHC/Tc/Gen/Head.hs
+++ b/compiler/GHC/Tc/Gen/Head.hs
@@ -8,7 +8,7 @@
 {-# LANGUAGE UndecidableInstances #-} -- Wrinkle in Note [Trees That Grow]

 {-# OPTIONS_GHC -Wno-incomplete-uni-patterns   #-}
-
+{-# OPTIONS_GHC -ddump-simpl -ddump-to-file -dverbose-core2core -ddump-stg-final #-}
 {-
 %
 (c) The University of Glasgow 2006

I then tried to build the compiler but I get:

hadrian/build -j14 --flavour=default+no_profiled_libs -o_build2

...

!!! CoreTidy [GHC.Tc.Gen.Head]: finished in 375.00 milliseconds, allocated 510.122 megabytes
*** CorePrep [GHC.Tc.Gen.Head]:
ghc.exe: panic! (the 'impossible' happened)
  (GHC version 9.3.20210428:
        toIfaceCoercionX
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler\\GHC\\Utils\\Panic.hs:181:37 in ghc:GHC.Utils.Panic
        pprPanic, called at compiler\\GHC\\CoreToIface.hs:316:35 in ghc:GHC.CoreToIface

Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug

This is likely caused by this commit as it introduced the panic:

6c7fff0b

@simonpj

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information