[GHC] #13233: typePrimRep panic while compiling GHC with profiling

GHC ghc-devs at haskell.org
Mon Feb 6 21:43:07 UTC 2017


#13233: typePrimRep panic while compiling GHC with profiling
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:
            Type:  bug               |               Status:  new
        Priority:  highest           |            Milestone:  8.2.1
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             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:                    |
-------------------------------------+-------------------------------------

Comment (by bgamari):

 Ahhh, here we have the issue. CorePrep is trying to prepare,
 {{{#!hs
   $fHasDynFlagsFCode2
     :: CgInfoDownwards -> CgState -> (# CgInfoDownwards, CgState #)
   $fHasDynFlagsFCode2 =
     (tick<getInfoDown> (#,#))
       @ 'LiftedRep @ 'LiftedRep @ CgInfoDownwards @ CgState
 }}}

 At first glance there is nothing particularly alarming about this.
 However, note the tick around `(#,#)`: this is quite bad since it cuts the
 `(#,#)` off from its `RuntimeRep` applications, making the whole
 expression appear much more polymorphic than it really is in
 `CorePrep.cpeApp`.

 Specifically, we first `collect_args` on the whole expression yielding,
 {{{#!hs
 collect_args (tick<getInfoDown> (#,#)) @'LiftedRep @'LiftedRep
 @CgInfoDownwards @CgState
    == (tick<getInfoDown> (#,#),
        [ CpeApp 'LiftedRep, CpeApp 'LiftedRep, CpeApp CgInfoDownwards,
 CpeApp CgState ]
       )
 }}}
 `cpe_app` then looks at the `tick<getInfoDown> (#,#)` to decide what to do
 next. Specifically, it wants to see a plain `Var`, but that's not what we
 have. Consequently we end up recursing via `cpeArg`, which will be
 deprived of knowledge of the `RuntimeRep` type applications.

 It's difficult to say what the right solution here is. I have yet to look
 into how we end up with the tick scoping over only the constructor; it's
 possible that the tick was pushed in too far. More coming.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13233#comment:14>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list