summaryrefslogtreecommitdiff
path: root/compiler/codeGen/CgPrimOp.hs
diff options
context:
space:
mode:
authorJohan Tibell <johan.tibell@gmail.com>2011-06-07 14:44:23 +0200
committerDavid Terei <davidterei@gmail.com>2011-06-07 11:58:06 -0700
commitd0faaa6fa0cecd23c5670fd199e9206275313666 (patch)
tree07cc52b24ef1716d9eb967526f7500552303f17c /compiler/codeGen/CgPrimOp.hs
parentf31e93496d7b7ec631b9402be9b566d0f5d2e1fa (diff)
downloadhaskell-d0faaa6fa0cecd23c5670fd199e9206275313666.tar.gz
Fix segfault in array copy primops on 32-bit
The second argument to C's memset was passed as a W8 while memset expects an int. Signed-off-by: David Terei <davidterei@gmail.com>
Diffstat (limited to 'compiler/codeGen/CgPrimOp.hs')
-rw-r--r--compiler/codeGen/CgPrimOp.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/codeGen/CgPrimOp.hs b/compiler/codeGen/CgPrimOp.hs
index c5a6644aba..fa7287d4a2 100644
--- a/compiler/codeGen/CgPrimOp.hs
+++ b/compiler/codeGen/CgPrimOp.hs
@@ -733,7 +733,7 @@ emitCloneArray info_p res_r src0 src_off0 n0 live = do
emitMemcpyCall dst_p src_p (n `cmmMulWord` wordSize) live
emitMemsetCall (cmmOffsetExprW dst_p n)
- (CmmLit (CmmInt (toInteger (1 :: Int)) W8))
+ (CmmLit (mkIntCLit 1))
(card_words `cmmMulWord` wordSize)
live
stmtC $ CmmAssign (CmmLocal res_r) arr
@@ -751,7 +751,7 @@ emitSetCards :: CmmExpr -> CmmExpr -> CmmExpr -> StgLiveVars -> Code
emitSetCards dst_start dst_cards_start n live = do
start_card <- assignTemp $ card dst_start
emitMemsetCall (dst_cards_start `cmmAddWord` start_card)
- (CmmLit (CmmInt (toInteger (1 :: Int)) W8))
+ (CmmLit (mkIntCLit 1))
((card (dst_start `cmmAddWord` n) `cmmSubWord` start_card)
`cmmAddWord` CmmLit (mkIntCLit 1))
live
@@ -795,8 +795,8 @@ emitMemmoveCall dst src n live = do
memmove = CmmLit (CmmLabel (mkForeignLabel (fsLit "memmove") Nothing
ForeignLabelInExternalPackage IsFunction))
--- | Emit a call to @memset@. The second argument must be of type
--- 'W8'.
+-- | Emit a call to @memset@. The second argument must fit inside an
+-- unsigned char.
emitMemsetCall :: CmmExpr -> CmmExpr -> CmmExpr -> StgLiveVars -> Code
emitMemsetCall dst c n live = do
vols <- getVolatileRegs live