summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Tibell <johan.tibell@gmail.com>2014-08-12 20:28:14 +0200
committerJohan Tibell <johan.tibell@gmail.com>2014-08-12 22:13:21 +0200
commit434204975bb6e25a3ec0d32fc225effb8eceb0c3 (patch)
treefe651c778b6b8fb103fb15a59fb626eebf50cb5e
parenta6fd7b5c4b8439bfcc56bf6924de64f4f32e7211 (diff)
downloadhaskell-434204975bb6e25a3ec0d32fc225effb8eceb0c3.tar.gz
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.
-rw-r--r--compiler/codeGen/StgCmmPrim.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/codeGen/StgCmmPrim.hs b/compiler/codeGen/StgCmmPrim.hs
index 2fa1b85a03..77739fe0fb 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