Opened 5 years ago

Closed 5 years ago

#2862 closed bug (fixed)

GHC Panic in ByteCodeGen

Reported by: nominolo Owned by:
Priority: normal Milestone:
Component: Compiler Version: 6.11
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:


Try to load the following problem with ghc --interactive of the latest HEAD.

{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-}

class Search id a where
  search :: a -> ()

instance Search id () where
  search d = undefined

-- works:
-- instance Search () () where  search d = undefined

You get an irrefutable pattern match error in ByteCodeGen:644

The code calls splitApp and expects an AnnVar v. What it gets instead is:

\ (@ id{tv af0} [sk]) -> search1{v rfK} [gid] @ id{tv af0} [sk]

The argument to splitApp was:

((((\ (@ id{tv af0} [sk]) ->
          search1{v rfK} [gid] @ id{tv af0} [sk])
       `cast` (forall id{tv af0} [sk].
               ghc-prim:GHC.Prim.sym{(w) tc 34v}
                 (main:Main.NTCo:T:Search{tc rfe}
                    id{tv af0} [sk] ghc-prim:GHC.Unit.(){(w) tc 40})
               :: <pred>forall id{tv af0} [sk].
                        ghc-prim:GHC.Unit.(){(w) tc 40} -> ghc-prim:GHC.Unit.(){(w) tc 40}
                        forall id{tv af0} [sk].
                        main:Main.T:Search{tc rf8}
                          id{tv af0} [sk] ghc-prim:GHC.Unit.(){(w) tc 40}))
        @ etaT_sg1{tv} [tv])
     `cast` (main:Main.NTCo:T:Search{tc rfe}
               etaT_sg1{tv} [tv] ghc-prim:GHC.Unit.(){(w) tc 40}
             :: <pred>main:Main.T:Search{tc rf8}
                        etaT_sg1{tv} [tv] ghc-prim:GHC.Unit.(){(w) tc 40}
                      ghc-prim:GHC.Unit.(){(w) tc 40}
                      -> ghc-prim:GHC.Unit.(){(w) tc 40}))
      eta_sg2{v} [lid]

Change History (1)

comment:1 Changed 5 years ago by simonmar

  • Difficulty set to Unknown
  • Resolution set to fixed
  • Status changed from new to closed

It works after this partial reversion:

Mon Dec 15 02:02:21 PST 2008  Simon Marlow <>
  * Revert CorePrep part of "Completely new treatment of INLINE pragmas..."
  The original patch said:
  * I made some changes to the way in which eta expansion happens in
    CorePrep, mainly to ensure that *arguments* that become let-bound
    are also eta-expanded.  I'm still not too happy with the clarity
    and robustness fo the result.
  Unfortunately this change apparently broke some invariants that were
  relied on elsewhere, and in particular lead to panics when compiling
  with profiling on.
  Will re-investigate in the new year.
Note: See TracTickets for help on using tickets.