summaryrefslogtreecommitdiff
path: root/testsuite/tests/codeGen/should_run/T18527.hs
blob: 3205981960a441ba7a555df26d92eb179997a31f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{-# LANGUAGE ForeignFunctionInterface #-}

module Main where

import Data.Bits (setBit)
import Data.Word (Word32)
import Data.Int (Int64)

main :: IO ()
main = offending 100 0 1

offending :: Int64 -> Int64 -> Word32 -> IO ()
offending h i id = do
    oldMask <- sendMessage h (2245) i 0
    let newMask = setBit oldMask (fromIntegral id)
    sendMessage h (2244) i newMask
    return ()

foreign import ccall "func"
    sendMessage :: Int64 -> Word32 -> Int64 -> Int64 -> IO Int64