GHC 9.4.4 fails with lookupIdSubst panic
Building mod-0.0.0.0
with GHC 9.4.4 fails:
$ cabal unpack mod-0.0.0.0 && cd mod-0.0.0.0 && cabal build -w ghc-9.4.4
[1 of 2] Compiling Data.Mod
<no location info>: error:
panic! (the 'impossible' happened)
GHC version 9.4.4:
lookupIdSubst
$fNumMod
InScope {x_a21t go_a6ph $c/_a6CJ $crecip_a6CQ $cfromRational_a6D5
$cquotRem_a6DP $crem_a6E5 $cdivide_a6ED $cgcd_a6EM $clcm_a6F0
$cfromNatural_a6GA $c*_a6Hq $cfromInteger_a6Iu $cfromEnum_a6KG
m_a6Pv $dKnownNat_a6Px $dIntegral_a6Py $s^%_d785 $s^%_d786
$s^%_d788 invertMod gcdExt_s7kV gcdExt_s7kW $ctoEnum_s7oJ lvl_s7rG
lvl_s7rK lvl_s7rS $wgo_s7uv $w$ctoEnum_s7uU $w$s^%_s7vI
$w$cquotRem_s7wc lvl_s7wO $s$wgo_s7xW}
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/GHC/Utils/Panic.hs:182:37 in ghc:GHC.Utils.Panic
pprPanic, called at compiler/GHC/Core/Subst.hs:260:17 in ghc:GHC.Core.Subst
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
GHC 9.2.5 and GHC 9.6.0 are unaffected.
Looks similar to #21689 (closed), but #21689 (comment 437590) claims that 9.4 series are unaffected, so unsure whether it is a duplicate.