[GHC] #10083: ghc: panic! (the 'impossible' happened)

GHC ghc-devs at haskell.org
Tue May 10 05:18:36 UTC 2016


#10083: ghc: panic! (the 'impossible' happened)
-------------------------------------+-------------------------------------
        Reporter:  hedayaty          |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.8.4
      Resolution:                    |             Keywords:  hs-boot
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  crash                              |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by ezyang):

 * keywords:   => hs-boot


Comment:

 Here is an interesting phenomenon in the test case in this bug: it does
 not infinite loop if you use `--make`. If we look carefully at the
 inlining log we can see why (I added an extra trace for when there is no
 unfolding):

 {{{
 Inlining done:
     T10083.eqRSR
 \ (ds_d1H8 [Occ=Once!] :: T10083.RSR)
   (ds_d1H9 [Occ=Once!] :: T10083.RSR) ->
   case ds_d1H8 of { T10083.MkRSR s1 [Occ=Once] ->
   case ds_d1H9 of { T10083.MkRSR s2 [Occ=Once] ->
   T10083a.eqSR s1 s2
   }
   }
 Inlining done:
     T10083a.eqSR
 \ (ds [Occ=Once!] :: T10083a.SR) (ds1 [Occ=Once!] :: T10083a.SR) ->
   case ds of { T10083a.MkSR r1 [Occ=Once] ->
   case ds1 of { T10083a.MkSR r2 [Occ=Once] -> T10083.eqRSR r1 r2 }
   }
 no unfolding eqRSR
 }}}

 Notice that once we unfold `eqSR`, there is NO INLINING on `eqRSR`!
 Coincidence? Absolutely not: when we compiled `B.hs` we added an `Id` to
 the HPT which has an unfolding referring to the `eqRSR` from the hs-boot
 file, which obviously doesn't have an inlining. And clearly we don't flush
 the HPT prior to typechecking `A.hs`. So we will stop inlining once we hit
 this hs-boot `Id`.

 The situation with one-shot is different, however: we haven't loaded the
 interface, and by the time we try to load the `Id` for `eqRSR` when
 loading the unfolding for `eqSR`, it's already in the environment and so
 we give it the right unfolding... disaster!

 There is something pesky going on with the interface loading business but
 that's for another bug.

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


More information about the ghc-tickets mailing list