Skip to content
Snippets Groups Projects
Commit e96a8bf8 authored by Ben Gamari's avatar Ben Gamari :turtle:
Browse files

T229: Rework to pass on 32-bit machines

Previously it failed with,

-T229: Data.Array.Base.safe_scale: Overflow; scale: 4, n: 4611686018427387904
-CallStack (from HasCallStack):
-  error, called at libraries/array/Data/Array/Base.hs ...
+T229: Ix{Int}.index: Index (17) out of range ((0,-1))
parent 1b9a4430
No related branches found
No related tags found
No related merge requests found
...@@ -5,5 +5,11 @@ import Data.Word ...@@ -5,5 +5,11 @@ import Data.Word
main :: IO () main :: IO ()
main = do main = do
-- This should fail due to integer overflow -- This should fail due to integer overflow
#if WORD_SIZE == 8
m <- newArray_ (0,2^62-1) :: IO (IOUArray Int Word32) -- allocates 0 bytes m <- newArray_ (0,2^62-1) :: IO (IOUArray Int Word32) -- allocates 0 bytes
readArray m 17 >>= print -- Read some random location in address space readArray m 17 >>= print -- Read some random location in address space
#else
m <- newArray_ (0,2^30-1) :: IO (IOUArray Int Word32) -- allocates 0 bytes
readArray m 17 >>= print -- Read some random location in address space
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment