[commit: packages/array] master: T229: Rework to pass on 32-bit machines (e96a8bf)

git at git.haskell.org git at git.haskell.org
Sat Mar 25 14:50:44 UTC 2017


Repository : ssh://git@git.haskell.org/array

On branch  : master
Link       : http://git.haskell.org/packages/array.git/commitdiff/e96a8bf8ae101a91cfebf7be1cf956376b951b43

>---------------------------------------------------------------

commit e96a8bf8ae101a91cfebf7be1cf956376b951b43
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Fri Mar 24 12:51:59 2017 -0400

    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))


>---------------------------------------------------------------

e96a8bf8ae101a91cfebf7be1cf956376b951b43
 tests/T229.hs | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/T229.hs b/tests/T229.hs
index 2265852..1d8c157 100644
--- a/tests/T229.hs
+++ b/tests/T229.hs
@@ -5,5 +5,11 @@ import Data.Word
 main :: IO ()
 main = do
   -- This should fail due to integer overflow
+#if WORD_SIZE == 8
   m <- newArray_ (0,2^62-1) :: IO (IOUArray Int Word32) -- allocates 0 bytes
   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
+



More information about the ghc-commits mailing list