diff options
author | Andreas Klebinger <klebinger.andreas@gmx.at> | 2022-05-24 14:00:01 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-05-24 22:13:55 -0400 |
commit | 81b3741fd5bacfa8fa63c8f963f1147036a6b0d9 (patch) | |
tree | 96029c4de2b8ea52360203918192c5422629b996 | |
parent | 7c51177d3e135cbba4bc170126c74825fd7bdd61 (diff) | |
download | haskell-81b3741fd5bacfa8fa63c8f963f1147036a6b0d9.tar.gz |
Fix #21563 by using Word64 for 64bit shift code.
We use the 64bit shifts only on 64bit platforms. But we
compile the code always so compiling it on 32bit caused a
lint error. So use Word64 instead.
-rw-r--r-- | compiler/GHC/ByteCode/Asm.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/GHC/ByteCode/Asm.hs b/compiler/GHC/ByteCode/Asm.hs index 427549b6fd..9163aeacd4 100644 --- a/compiler/GHC/ByteCode/Asm.hs +++ b/compiler/GHC/ByteCode/Asm.hs @@ -302,7 +302,7 @@ runAsm platform long_jumps e = go words = concatMap expand ops expand (SmallOp w) = [w] expand (LabelOp w) = expand (Op (e w)) - expand (Op w) = if largeOps then largeArg platform w else [fromIntegral w] + expand (Op w) = if largeOps then largeArg platform (fromIntegral w) else [fromIntegral w] -- expand (LargeOp w) = largeArg platform w state $ \(st_i0,st_l0,st_p0) -> let st_i1 = addListToSS st_i0 (opcode : words) @@ -345,13 +345,14 @@ inspectAsm platform long_jumps initial_offset largeArgInstr :: Word16 -> Word16 largeArgInstr bci = bci_FLAG_LARGE_ARGS .|. bci -largeArg :: Platform -> Word -> [Word16] +largeArg :: Platform -> Word64 -> [Word16] largeArg platform w = case platformWordSize platform of PW8 -> [fromIntegral (w `shiftR` 48), fromIntegral (w `shiftR` 32), fromIntegral (w `shiftR` 16), fromIntegral w] - PW4 -> [fromIntegral (w `shiftR` 16), + PW4 -> assert (w < fromIntegral (maxBound :: Word32)) $ + [fromIntegral (w `shiftR` 16), fromIntegral w] largeArg16s :: Platform -> Word |