[GHC] #9390: Inlining prevents evaluation of ignored parts of unboxed tuples

GHC ghc-devs at haskell.org
Wed Aug 6 10:11:57 UTC 2014


#9390: Inlining prevents evaluation of ignored parts of unboxed tuples
-------------------------------------+-------------------------------------
              Reporter:  snoyberg    |            Owner:
                  Type:  bug         |           Status:  new
              Priority:  normal      |        Milestone:  7.8.4
             Component:  Compiler    |          Version:  7.8.3
            Resolution:              |         Keywords:
      Operating System:  Linux       |     Architecture:  x86_64 (amd64)
       Type of failure:  Incorrect   |       Difficulty:  Unknown
  result at runtime                  |       Blocked By:
             Test Case:              |  Related Tickets:
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 My comment meant that the `x` thunk will reliably be evaluated only after
 performing the `write A` side effect.

 The question of whether it is performed before the freeze is quite a
 separate one.  Yes it will, because the `seq` ensures that (in effect)
 there is a data dependency between `x` and `(V.freeze vm >>= print)`, so
 we can't perform the latter action until we have evaluated `x`.  If
 instead of {{{x `seq` (V.freeze vm >> print)}}} we'd written
 {{{
   if x>0 then V.freeze vm >> print
          else print "hello"
 }}}
 it would be totally clear that you couldn't do the freeze until `x` was
 evaluated.  And `seq` behaves like that.

 Does that make it clearer?

 Simon

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


More information about the ghc-tickets mailing list