[GHC] #14430: lintUnfolding does not allow unfoldings to jump to enclosing join points

GHC ghc-devs at haskell.org
Tue Nov 7 22:46:37 UTC 2017


#14430: lintUnfolding does not allow unfoldings to jump to enclosing join points
-------------------------------------+-------------------------------------
        Reporter:  nomeata           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 The key idea is this: an unfolding is like an extra RHS for the function.

 So yes, this is a bug.

 On inspection, it's caused by `lintUnfolding` being called in the wrong
 place:

 * We want `lintUnfolding` to be called, once for all, on the unfolding (if
 any) of each top-level Id; that is, in the `IfaceId` case of
 `tc_iface_decl`.

 * But it isn't!  Instead `lintUnfolding` is called by `tcPragExpr`, which
 is called from `tcUnfolding` which is called for each nested unfolding in
 the interface-file declaration.

 * This is inefficient, because the top-level call will re-lint the nested
 unfoldings; and it's wrong for the reason you point out.

 In the olden days there were no nested unfoldings in interface0-file
 definitions, which is why this bug got started.

 Might you fix, Joachim?

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


More information about the ghc-tickets mailing list