[GHC] #16346: Lint error on master: Occurrence is GlobalId, but binding is LocalId
GHC
ghc-devs at haskell.org
Wed Feb 20 14:52:03 UTC 2019
#16346: Lint error on master: Occurrence is GlobalId, but binding is LocalId
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.6.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):
Here's why the second crash happens. We start with
{{{
case M.f_2dr[GblId] of f' { W# y ->
let f_2dr[LclId] = f' in
case M.f_2dr[GblId] of { W# z ->
blah
}}}
(All this is in the body of `$s$fGBinaryGetTYPE:+:1_sfOT` in
`Distribution.Types.ComponentRequestedSpec`.)
Then
* It turns out that `M.f_2dr` is a HNF so the first case can vanish. We
extend the substitution with `f' :-> M.f_2dr[GblId]`.
* We simplify the RHS of the `let` to get `M.f_2dr[GblId]`
* We simplify the let-binder. It's not in scope, so we don't mess with
its unique, and we extend the in-scope set with `M.f_2dr[LclId]`.
* Now post-inline-unconditionally fires, so we extend the substitution
with `f_2dr :-> M.f_2dr[GblId]`
* Now at the occurrence of `M.f_2dr[GblId]` we find it in the
substitution, mapping to, well, `M.f_2dr[GblId]`.
* Then we look that up in the in-scope set, and get `M.f_2dr[LclId]`
* And that is not in scope.
What a mess.
My conclusion: it's a total disaster to have a local binding for a
`LocalId` that shares a unique with a `GlobalId`.
We have multiple hacks to avoid trouble, and they don't even work.
Let's stop doing it. See #16296.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16346#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list