summaryrefslogtreecommitdiff
path: root/testsuite/tests/rts/T13894.hs
blob: e09e90802cc679dc1d0e58b58aec8a8bd93deee6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
-- Test that isByteArray# returns True for large but not explicitly pinned byte
-- arrays

{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples  #-}

import Control.Monad
import GHC.Exts
import GHC.IO

main :: IO ()
main = do
    pinned <- IO $ \s0 ->
      case newByteArray# 1000000# s0 of
        (# s1, arr# #) ->
            case isMutableByteArrayPinned# arr# of
              n# -> (# s1, isTrue# n# #)
    unless pinned $ putStrLn "BAD"