[GHC] #15128: emitPrimOp: can't translate PrimOp

GHC ghc-devs at haskell.org
Mon May 7 07:17:39 UTC 2018


#15128: emitPrimOp: can't translate PrimOp
-------------------------------------+-------------------------------------
        Reporter:  tianxiaogu        |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.5
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by osa1):

 Smaller reproducer:

 {{{#!haskell
 {-# LANGUAGE MagicHash #-}
 {-# LANGUAGE UnboxedTuples #-}

 module Lib where

 import GHC.Exts (Int (..), MutableByteArray#, byteArrayContents#,
                  newPinnedByteArray#, unsafeCoerce#)
 import GHC.Ptr (Ptr (..))
 import GHC.ST (ST (..))

 data MByteArray s = MByteArray { unMBA :: MutableByteArray# s }

 newPinnedByteArray :: Int -> ST s (Ptr a, MByteArray s)
 newPinnedByteArray (I# n#) = ST $ \s# ->
     case newPinnedByteArray# n# s# of
         (# s2#, marr# #) ->
           (# s2#, ( Ptr (byteArrayContents# (unsafeCoerce# s#)),
 MByteArray marr# ) #)
 }}}

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


More information about the ghc-tickets mailing list