summaryrefslogtreecommitdiff
path: root/testsuite/tests/codeGen/should_fail/CheckBoundsCopyByteArray.hs
blob: d5e5e6b65fa8b34ed6fb59a12743d3147372647b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE MagicHash #-}

module Main where

import GHC.Exts
import GHC.IO

main :: IO ()
main = do
    IO $ \s0 ->
      case newByteArray# 4# s0 of
        (# s1, src_marr #) ->
          case newByteArray# 4# s1 of
            (# s2, dst_marr #) ->
              case unsafeFreezeByteArray# src_marr s2 of
                (# s3, src_arr #) ->
                  case copyByteArray# src_arr 0# dst_marr 1# 4# s3 of
                    s4 -> (# s4, () #)