#13750: GHC produces incorrect coercions in hairy code -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Runtime crash Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Andres Löh has been working with an optimized version of generics-sop, and ran into segfaults. He was able to reduce the test case to the attached (still not tiny) one, and could reduce it no further. He discovered the following utterly bogus definition in `-ddump-simpl` (with -O): {{{ Main.gshowP_$dAll :: All MyShow GHC.Exts.Any [GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False, WorkFree=False, Expandable=True, Guidance=IF_ARGS [] 20 0}] Main.gshowP_$dAll = ghc-prim-0.5.0.0:GHC.Classes.$p1(%,%) @ (All MyShow GHC.Exts.Any) @ (All (All MyShow) GHC.Exts.Any) (ghc-prim-0.5.0.0:GHC.Classes.C:(%%) `cast` (Sub (Sym (Main.D:R:AllFk_c[][0] <[*]>_N <All MyShow>_N)) ; Sym (Main.N:All[0] <[*]>_N <All MyShow>_N <'[]>_N) ; Sub (Nth:1 (Sub (Sym (Main.D:R:AllFkc:[0] <[*]>_N <All MyShow>_N <'[Char]>_N <'[]>_N)) ; (AllF <[*]>_N <All MyShow>_N ((':) <[*]>_N (UnsafeCo nominal '[Char] GHC.Exts.Any) (UnsafeCo nominal '[] GHC.Exts.Any))_N)_R ; Sub (Main.D:R:AllFkc:[0] <[*]>_N <All MyShow>_N <GHC.Exts.Any>_N <GHC.Exts.Any>_N))) ; Main.N:All[0] <[*]>_N <All MyShow>_N (UnsafeCo nominal GHC.Exts.Any (GHC.Exts.Any : GHC.Exts.Any)) ; Sub (Main.D:R:AllFkc:[0] <[*]>_N <All MyShow>_N <GHC.Exts.Any>_N <GHC.Exts.Any>_N) :: (() :: Constraint :: Constraint) ~R# ((All MyShow GHC.Exts.Any, All (All MyShow) GHC.Exts.Any) :: Constraint))) }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13750> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler