diff options
author | Ben Gamari <ben@smart-cactus.org> | 2022-08-06 00:06:03 -0400 |
---|---|---|
committer | Zubin Duggal <zubin.duggal@gmail.com> | 2022-10-26 15:39:08 +0530 |
commit | 8a38c548839c684b16a61966b2a809a8d0909719 (patch) | |
tree | 14e0d2dd409b5839f0b8000d072eaa757af9ce97 /testsuite/tests | |
parent | c45387ceeb60797534601d62c66bdd5e6b7f1cda (diff) | |
download | haskell-8a38c548839c684b16a61966b2a809a8d0909719.tar.gz |
rts: Don't clear cards of zero-length arrays
Fix #21962, where attempting to clear the card table of a zero-length
array resulted in an integer underflow.
Diffstat (limited to 'testsuite/tests')
-rw-r--r-- | testsuite/tests/array/should_run/T21962.hs | 12 | ||||
-rw-r--r-- | testsuite/tests/array/should_run/all.T | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/testsuite/tests/array/should_run/T21962.hs b/testsuite/tests/array/should_run/T21962.hs new file mode 100644 index 0000000000..ab96760289 --- /dev/null +++ b/testsuite/tests/array/should_run/T21962.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE UnboxedTuples #-} +{-# LANGUAGE MagicHash #-} + +module Main where + +import GHC.IO +import GHC.Exts + +main :: IO () +main = do + IO $ \s0 -> case newArray# 0# () s0 of (# s1, arr #) -> (# s1, () #) + IO $ \s0 -> case newArrayArray# 0# s0 of (# s1, arr #) -> (# s1, () #) diff --git a/testsuite/tests/array/should_run/all.T b/testsuite/tests/array/should_run/all.T index 6b5500700e..3c4e7cb755 100644 --- a/testsuite/tests/array/should_run/all.T +++ b/testsuite/tests/array/should_run/all.T @@ -24,3 +24,4 @@ test('arr017', when(fast(), skip), compile_and_run, ['']) test('arr018', when(fast(), skip), compile_and_run, ['']) test('arr019', normal, compile_and_run, ['']) test('arr020', normal, compile_and_run, ['']) +test('T21962', normal, compile_and_run, ['']) |