[GHC] #13457: unsafeInterleaveST is too unsafe

GHC ghc-devs at haskell.org
Wed Mar 22 21:29:26 UTC 2017


#13457: unsafeInterleaveST is too unsafe
-------------------------------------+-------------------------------------
        Reporter:  dfeuer            |                Owner:  dfeuer
            Type:  bug               |               Status:  patch
        Priority:  normal            |            Milestone:  8.4.1
       Component:  Core Libraries    |              Version:  8.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect result  |  Unknown/Multiple
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D3370
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by David Feuer <David.Feuer@…>):

 In [changeset:"30d68d630c1685bb81ec4afdaf6d483ba8aafd38/ghc"
 30d68d63/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="30d68d630c1685bb81ec4afdaf6d483ba8aafd38"
 Make unsafeInterleaveST less unsafe

 * Make `unsafeInterleaveST` use `noDuplicate#` like
 `unsafeInterleaveIO` does to prevent the suspended action from
 being run in two threads.

 * In order to accomplish this without `unsafeCoerce#`, generalize
 the type of `noDuplicate#`.

 * Add `unsafeDupableInterleaveST` to get the old behavior.

 * Document unsafe `ST` functions and clean up some related
 documentation.

 Fixes #13457

 Reviewers: austin, hvr, bgamari, ekmett

 Reviewed By: bgamari

 Subscribers: rwbarton, thomie

 Differential Revision: https://phabricator.haskell.org/D3370
 }}}

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


More information about the ghc-tickets mailing list