[GHC] #13857: compactAdd doesn't work with SmallArray#

GHC ghc-devs at haskell.org
Wed May 16 14:35:28 UTC 2018


#13857: compactAdd doesn't work with SmallArray#
-------------------------------------+-------------------------------------
        Reporter:  andrewthad        |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.2.2
       Component:  Runtime System    |              Version:  8.2.1-rc2
      Resolution:                    |             Keywords:  compact
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D3888
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by andrewthad):

 The reason why this wasn't caught earlier is that the test for compacting
 `SmallArray#` doesn't actually work. From D3888, we have [this test
 https://phabricator.haskell.org/differential/changeset/?ref=174725&whitespace
 =ignore-most]:

 {{{
 import GHC.Compact
 import Data.Primitive.SmallArray

 main :: IO ()
 main = do
     arr <- newSmallArray 5 (Just 'a')
     arr' <- compact arr
     print $ getCompact arr'
 }}}

 However, this fails at runtime with

 {{{
 compact_hash_map: compaction failed: cannot compact mutable objects
 }}}

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


More information about the ghc-tickets mailing list