[GHC] #14346: 8.2.1 regression: heap corruption after safe foreign calls

GHC ghc-devs at haskell.org
Mon Jul 30 22:00:03 UTC 2018


#14346: 8.2.1 regression: heap corruption after safe foreign calls
-------------------------------------+-------------------------------------
        Reporter:  andrewchen        |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  highest           |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.5
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  Runtime crash     |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #15260            |  Differential Rev(s):  Phab:D5020
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Ben Gamari <ben@…>):

 In [changeset:"56590db07a776ce81eb89d4a4d86bd0f953fb44e/ghc" 56590db/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="56590db07a776ce81eb89d4a4d86bd0f953fb44e"
 base: Make Foreign.Marshal.Alloc.allocBytes[Aligned] NOINLINE

 As noted in #14346, touch# may be optimized away when the simplifier can
 see
 that the continuation passed to allocaBytes will not return. Marking CPS-
 style
 functions with NOINLINE ensures that the simplier can't draw any unsound
 conclusions.

 Ultimately the right solution here will be to do away with touch# and
 instead
 introduce a scoped primitive as is suggested in #14375.

 Note: This was present in 8.2 but was never merged to 8.4 in hopes that
 we would have #14375 implemented in time. This meant that the issue
 regressed again in 8.4. Thankfully we caught it in time to fix it for
 8.6.

 (cherry picked from commit 404bf05ed3193e918875cd2f6c95ae0da5989be2)
 }}}

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


More information about the ghc-tickets mailing list