[GHC] #14128: Possible bug in Renamer when dealing with orphans

GHC ghc-devs at haskell.org
Tue Aug 29 18:01:18 UTC 2017


#14128: Possible bug in Renamer when dealing with orphans
-------------------------------------+-------------------------------------
        Reporter:  Shayan-Najd       |                Owner:  bgamari
            Type:  bug               |               Status:  patch
        Priority:  normal            |            Milestone:  8.2.2
       Component:  Compiler (Type    |              Version:  8.2.1
  checker)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D3892
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Ben Gamari <ben@…>):

 In [changeset:"db3a8e168ad81f54ec58eebc4c75a0eaad889daf/ghc"
 db3a8e16/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="db3a8e168ad81f54ec58eebc4c75a0eaad889daf"
 desugar: Ensure that a module's dep_orphs doesn't contain itself

 Consider that we have two modules, A and B, both with hs-boot files,

   * A.hs contains a SOURCE import of B
   * B.hs-boot contains a SOURCE import of A
   * A.hs-boot declares an orphan instance
   * A.hs defines the orphan instance

 In this case, B's dep_orphs will contain A due to its SOURCE import of
 A.  Consequently, A will contain itself in its imp_orphs due to its
 import of B.  This fact would end up being recorded in A's interface
 file. This would then break the invariant asserted by calculateAvails
 that a module does not itself in its dep_orphs. This was the cause
 of #14128.

 The solution is to remove self-references from imp_orphs when
 constructing dep_orphs; we already did a similar thing for dep_mods. I
 believe we should do the same for dep_finsts, although I'm treating this
 as a separate bug.

 Reviewers: austin

 Subscribers: rwbarton, thomie

 Differential Revision: https://phabricator.haskell.org/D3892
 }}}

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


More information about the ghc-tickets mailing list