[GHC] #13331: Worker/wrapper can lead to sharing failure
GHC
ghc-devs at haskell.org
Fri Feb 24 17:09:02 UTC 2017
#13331: Worker/wrapper can lead to sharing failure
-------------------------------------+-------------------------------------
Reporter: dfeuer | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.4.1
Component: Compiler | Version: 8.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Runtime | Unknown/Multiple
performance bug | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by dfeuer):
Actually, I just discovered that we don't even need pointer equality to
reproduce!
{{{#!hs
naiveInsert1 :: Ord k => k -> a -> Map k a -> Map k a
naiveInsert1 kx0 = go kx0
where
--go :: Ord k => k -> a -> Map k a -> Map k a
go !kx x Tip = singleton kx0 x
go !kx x t@(Bin sz ky y l r) =
case compare kx ky of
LT -> balanceL ky y l' r
where !l' = go kx x l
GT -> balanceR ky y l r'
where !r' = go kx x r
EQ -> Bin sz kx0 x l r
{-# INLINABLE naiveInsert1 #-}
}}}
and
{{{#!hs
naiveInsert2 :: Ord k => k -> a -> Map k a -> Map k a
naiveInsert2 = go
where
go :: Ord k => k -> a -> Map k a -> Map k a
go !kx x Tip = singleton kx x
go !kx x t@(Bin sz ky y l r) =
case compare kx ky of
LT -> balanceL ky y l' r
where !l' = go kx x l
GT -> balanceR ky y l r'
where !r' = go kx x r
EQ -> Bin sz kx x l r
{-# INLINABLE naiveInsert2 #-}
}}}
both demonstrate the same problem.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13331#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list