[GHC] #13330: forkIO has inconsistent behavior under optimization

GHC ghc-devs at haskell.org
Wed Mar 1 17:26:33 UTC 2017


#13330: forkIO has inconsistent behavior under optimization
-------------------------------------+-------------------------------------
        Reporter:  dfeuer            |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Core Libraries    |              Version:  8.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  Other             |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D3189
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by dfeuer):

 Simon, I definitely think more needs to be done in this area. I'm not yet
 convinced that `catchException` is really useful at the moment; we should
 probably just use `catch`, and force exactly what we need to. I am also
 concerned about `catchRetry#` and `catchSTM#` (see #13357).

 However, I just realized that we probably ''can'' do something a bit more
 interesting with `catch`. In particular, something definitely used by
 ''both'' the action ''and'' the recovery function can safely be forced in
 advance. So if we see, for example,

 {{{#!hs
 f x = (x `seq` ...) `catch` \e -> x `seq` ...
 }}}

 then we can surely use

 {{{#!hs
 f x = IO $ \s -> x `seq` unIO (... `catch` ...)
 }}}

 I don't yet know enough about the demand analysis algorithm to see how to
 do this, but it seems rather likely to be worth trying.

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


More information about the ghc-tickets mailing list