summaryrefslogtreecommitdiff
path: root/testsuite/tests/rts/overflow1.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/rts/overflow1.hs')
-rw-r--r--testsuite/tests/rts/overflow1.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/testsuite/tests/rts/overflow1.hs b/testsuite/tests/rts/overflow1.hs
new file mode 100644
index 0000000000..63ed5a4e02
--- /dev/null
+++ b/testsuite/tests/rts/overflow1.hs
@@ -0,0 +1,11 @@
+module Main where
+
+import Data.Array.IO
+import Data.Word
+
+-- Try to overflow BLOCK_ROUND_UP in the computation of req_blocks in allocate()
+-- Here we invoke allocate() via newByteArray# and the array package.
+-- Request a number of bytes close to HS_WORD_MAX,
+-- subtracting a few words for overhead in newByteArray#.
+-- Allocate Word32s (rather than Word8s) to get around bounds-checking in array.
+main = newArray (0,maxBound `div` 4 - 10) 0 :: IO (IOUArray Word Word32)