Specialiser creates specialisation assuming local equality
Carrying on from #23109
I have extracted a reproducer for that issue which doesn't depend on anything in
horde-ad so it's much simpler. It still needs to depend on the plugins though but I suspect that the plugin dependencies can also be removed.
If you compile with
ghc-9.6.1 you get
32 repro: Bad runtime result CallStack (from HasCallStack): error, called at Main.hs:11:57 in main:Main
The problem is along the lines of:
- In the call to
- In the body of
$stbuild'(in the recursive call to the specialiser), in the binding of
buildSh, there is a call to
typeRep (Proxy @ix), the specialiser creates a bogus specialisation here.
"SPEC/TestHighRankSimplified typeNatTypeRep @_" forall (@(ipv_i1oF :: GHC.TypeNats.Nat)) ($dKnownNat_s1HG :: GHC.TypeNats.KnownNat ipv_i1oF). base:Data.Typeable.Internal.typeNatTypeRep @ipv_i1oF $dKnownNat_s1HG = $stypeNatTypeRep_s1HJ @ipv_i1oF
spec3rewrites using this specialisation giving a bogus result.
Perhaps someone can help either removing the dependency on the plugins or further minimising it.