[GHC] #10176: Invalid core generated with GHC 7.10 RC3

GHC ghc-devs at haskell.org
Sat Mar 21 14:47:44 UTC 2015


#10176: Invalid core generated with GHC 7.10 RC3
-------------------------------------+-------------------------------------
        Reporter:  NeilMitchell      |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  high              |               Milestone:  7.10.1
       Component:  Compiler          |                 Version:  7.10.1-rc3
      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 nomeata):

 Ok, I think here is what happens, at least in my smaller test case:

  1. Call Arity determines that `error1Arg` is always called with two
 arguments. Hence `CallArity=2`. This is correct.
  2. The simplifier tries to eta-expand `error1Arg` to take two arguments.
 This fails in `mkEtaWW` in `CoreArity`, where we have this comment:
     {{{
         -- This *can* legitmately happen:
         -- e.g.  coerce Int (\x. x) Essentially the programmer is
         -- playing fast and loose with types (Happy does this a lot).
         -- So we simply decline to eta-expand.  Otherwise we'd end up
         -- with an explicit lambda having a non-function type
     }}}
  3. But still, the `Arity` field is updated.
  4. Since it has `Arity=2`, `exprIsHNF (error1Arg @ _ ())` is true, and
 the simplifier does strange things.

 So maybe the solution is to ''not'' update `Arity` with the result from
 Call Arity, but instead let eta-expansion happen and update `Arity` with
 the manifest arity after eta expansion. I’ll try that.

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


More information about the ghc-tickets mailing list