
#13410: GHC HEAD regression: Template variable unbound in rewrite rule
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: (none)
Type: bug | Status: new
Priority: highest | Milestone: 8.2.1
Component: Compiler | Version: 8.1
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: Compile-time
Unknown/Multiple | crash or panic
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
`hybrid-vectors-0.2.1` currently fails to build with GHC HEAD. I've
attached a minimized repro file with no dependencies (it's 410 lines long,
since I had to copy-paste a lot of code from `vector` in order to
reproduce this). The attached file builds on GHC 7.10.3 and 8.0.2, but
fails on GHC HEAD with this panic:
{{{
$ ~/Software/ghc2/inplace/bin/ghc-stage2 -O2 -fforce-recomp Bug.hs
[1 of 1] Compiling Data.Vector.Hybrid.Internal ( Bug.hs, Bug.o )
Bug.hs:389:10: warning: [-Wmissing-methods]
• No explicit implementation for
‘gmbasicOverlaps’, ‘gmbasicInitialize’, and ‘gmbasicUnsafeRead’
• In the instance declaration for ‘GMVector (MVector u v) (a, b)’
|
389 | instance (GMVector u a, GMVector v b) => GMVector (MVector u v) (a,
b) where
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Bug.hs:407:10: warning: [-Wmissing-methods]
• No explicit implementation for
‘gbasicUnsafeFreeze’, ‘gbasicUnsafeThaw’, ‘gbasicLength’,
‘gbasicUnsafeSlice’, and ‘gbasicUnsafeIndexM’
• In the instance declaration for ‘GVector (Vector u v) (a, b)’
|
407 | instance (GVector u a, GVector v b) => GVector (Vector u v) (a, b)
where
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.3.20170310 for x86_64-unknown-linux):
Template variable unbound in rewrite rule
Variable: sc_s8FV
Rule "SC:$j0"
Rule bndrs: [sc_s8FV, sc_s8FW, sc_s8FX, sg_s8FY, sc_s8FU]
LHS args: [sc_s8FU,
(MV
@ (GMutable u_a4oM)
@ (GMutable v_a4oO)
@ (PrimState (ST RealWorld))
@ (a_a4oN, b_a4oP)
@ a_a4oN
@ b_a4oP
@~ (<(a_a4oN, b_a4oP)>_N
:: ((a_a4oN, b_a4oP) :: *) ~# ((a_a4oN, b_a4oP) :: *))
sc_s8FW
sc_s8FX)
`cast` (sg_s8FY
:: (MVector
(GMutable u_a4oM)
(GMutable v_a4oO)
(PrimState (ST RealWorld))
(a_a4oN, b_a4oP) :: *)
~R#
(GMutable
(Vector u_a4oM v_a4oO) (PrimState (ST
RealWorld)) c_a4oQ :: *))]
Actual args: [sc_s8FS,
wild_X3x
`cast` (Sub
(Sym (D:R:GMutableVector[0]