[GHC] #13077: Worker/wrapper can break the let-app invariant

GHC ghc-devs at haskell.org
Fri Jan 13 15:13:40 UTC 2017


#13077: Worker/wrapper can break the let-app invariant
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      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 a related one where we need to record evaluted-ness on CPR result
 binders
 {{{
 data X = A | B | C

 data T = MkT !X Int# Int#

 g :: Int -> T
 g 0 = MkT A 1# 2#
 g n = g (n-1)


 boo :: Int -> T
 boo k = case g k of
           MkT x n _ -> let v = case x of
                                   A -> 1#
                                   B -> 2#
                                   C -> n
                        in MkT x v v
 }}}
 Here we get a wrapper for `g` like this
 {{{
 g x = case $wg x of
         (# w1, w2 #) -> MkT w1 w2 w2
 }}}
 It's important to record that `w1` is evaluated, as the use in `boo` makes
 clear.

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


More information about the ghc-tickets mailing list