[commit: ghc] master: StgCmmPrim: add note to stop using fixed size signed types for sizes (4342049)
git at git.haskell.org
git at git.haskell.org
Tue Aug 12 20:13:37 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/434204975bb6e25a3ec0d32fc225effb8eceb0c3/ghc
>---------------------------------------------------------------
commit 434204975bb6e25a3ec0d32fc225effb8eceb0c3
Author: Johan Tibell <johan.tibell at gmail.com>
Date: Tue Aug 12 20:28:14 2014 +0200
StgCmmPrim: add note to stop using fixed size signed types for sizes
We use fixed size signed types to e.g. represent array sizes. This
means that the size can overflow.
>---------------------------------------------------------------
434204975bb6e25a3ec0d32fc225effb8eceb0c3
compiler/codeGen/StgCmmPrim.hs | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/compiler/codeGen/StgCmmPrim.hs b/compiler/codeGen/StgCmmPrim.hs
index 2fa1b85..77739fe 100644
--- a/compiler/codeGen/StgCmmPrim.hs
+++ b/compiler/codeGen/StgCmmPrim.hs
@@ -137,6 +137,11 @@ cgOpApp (StgPrimCallOp primcall) args _res_ty
asUnsigned :: Width -> Integer -> Integer
asUnsigned w n = n .&. (bit (widthInBits w) - 1)
+-- TODO: Several primop implementations (e.g. 'doNewByteArrayOp') use
+-- ByteOff (or some other fixed width signed type) to represent
+-- array sizes or indices. This means that these will overflow for
+-- large enough sizes.
+
-- | Decide whether an out-of-line primop should be replaced by an
-- inline implementation. This might happen e.g. if there's enough
-- static information, such as statically know arguments, to emit a
More information about the ghc-commits
mailing list