[GHC] #10182: lookupIfaceGlobal crash with SOURCE import

GHC ghc-devs at haskell.org
Tue Apr 21 09:28:11 UTC 2015


#10182: lookupIfaceGlobal crash with SOURCE import
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:  7.12.1
       Component:  Compiler          |                 Version:  7.8.4
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by ezyang):

 Here is what's going on: when a self-import occurs, the hi-boot for the
 current module is being loaded into the EPS by `loadInterface`. **This
 should never happen.** However, in the absence of type class instances,
 this is relatively harmless, as we won't actually look in the EPS to find
 names for locally defined identifiers. However, there is one case where we
 always consult the EPS: instance lookup!

 An orphan instance also causes an EPS-updating load of the hi-boot, even
 absent a direct import, as the boot file will be recorded as an orphan and
 thus we'll try to load it.

 One thing that is a bit tiresome is that on a direct `{-# SOURCE #-}`
 import, we really do need to read in the boot interface (just not add it
 to the EPS), since we might be some identifiers in another namespace:

 {{{
 -- A.hs-boot
 module A(Bool) where
 -- A.hs
 module A(Bool) where
 import {-# SOURCE #-} qualified A as A2
 data X = X A2.Bool
 }}}

 But this has never actually worked with declarations in the hs-boot
 itself, see #7672.

 (I spent some time being confused at the interface trace, which claimed
 `Reading [boot] interface for T8743` even in non buggy cases. This is
 because we always load the `hi-boot` interface to compare against the
 "Real Thing"; however, THIS goes through `tcHiBootIface`, which DOES NOT
 update the EPS.)

 I suspect simonpj's original test case was not fully reduced due to
 #10333.

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


More information about the ghc-tickets mailing list