[GHC] #9390: Inlining prevents evaluation of ignored parts of unboxed tuples

GHC ghc-devs at haskell.org
Fri Aug 1 05:54:45 UTC 2014


#9390: Inlining prevents evaluation of ignored parts of unboxed tuples
-------------------------------------+-------------------------------------
              Reporter:  snoyberg    |            Owner:
                  Type:  bug         |           Status:  new
              Priority:  normal      |        Milestone:
             Component:  Compiler    |          Version:  7.8.3
            Resolution:              |         Keywords:
      Operating System:  Linux       |     Architecture:  x86_64 (amd64)
       Type of failure:  Incorrect   |       Difficulty:  Unknown
  result at runtime                  |       Blocked By:
             Test Case:              |  Related Tickets:
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by carter):

 {{{
 {-# LANGUAGE BangPatterns,  UnboxedTuples,MagicHash #-}

 import Data.ByteString.Internal (inlinePerformIO)
 import qualified Data.Vector as V
 import qualified Data.Vector.Mutable as VM

 import System.IO.Unsafe

 main :: IO ()
 main = do
     vm <- VM.new 1
     VM.write vm 0 'A'
     !b<- return $! 'B'
     let !x = unsafePerformIO $! VM.write vm 0 b
     x `seq` (V.freeze vm >>= print)

 }}}

 will output fromList "B" at O0 and and fromList "A" at O1 and O2, so Its
 not related to using InlinePerformIO (which made me a bit more skeptical,
 but then i then saw that I can hit this problem without
 accurseevilperformIO)

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


More information about the ghc-tickets mailing list