summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2022-10-27 18:03:10 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-12-22 23:36:10 -0500
commit914f7fe3756734714a6795fc4bbca96442b01f92 (patch)
tree30a5e7d49931a01b0b92f3c87f746db3ccae2ca4 /testsuite
parentfc3a2232da89ed4442b52a99ba1826d04362a7e8 (diff)
downloadhaskell-914f7fe3756734714a6795fc4bbca96442b01f92.tar.gz
Don't consider large byte arrays/compact regions pinned.
Workaround for #22255 which showed how treating large/compact regions as pinned could cause segfaults.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/rts/T13894.hs6
-rw-r--r--testsuite/tests/rts/T14900.hs2
-rw-r--r--testsuite/tests/rts/T14900.stdout4
3 files changed, 7 insertions, 5 deletions
diff --git a/testsuite/tests/rts/T13894.hs b/testsuite/tests/rts/T13894.hs
index e09e90802c..226ba18aa7 100644
--- a/testsuite/tests/rts/T13894.hs
+++ b/testsuite/tests/rts/T13894.hs
@@ -1,5 +1,5 @@
--- Test that isByteArray# returns True for large but not explicitly pinned byte
--- arrays
+-- Test that isByteArray# returns False for large but not explicitly pinned byte
+-- arrays, see #22255
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}
@@ -15,4 +15,4 @@ main = do
(# s1, arr# #) ->
case isMutableByteArrayPinned# arr# of
n# -> (# s1, isTrue# n# #)
- unless pinned $ putStrLn "BAD"
+ when pinned $ putStrLn "BAD"
diff --git a/testsuite/tests/rts/T14900.hs b/testsuite/tests/rts/T14900.hs
index 613f66d3a9..e1de9a6a89 100644
--- a/testsuite/tests/rts/T14900.hs
+++ b/testsuite/tests/rts/T14900.hs
@@ -13,6 +13,8 @@ newByteArray (I# sz) = IO $ \s -> case newByteArray# sz s of {
(# s', arr# #) -> case unsafeFreezeByteArray# arr# s of {
(# s'', barr# #) -> (# s', ByteArray barr# #) }}
+-- Currently we expect large/compact regions not to count as pinned.
+-- See #22255 for the reasoning.
main :: IO ()
main = do
ByteArray arr1# <- fmap getCompact $ newByteArray 65000 >>= compact
diff --git a/testsuite/tests/rts/T14900.stdout b/testsuite/tests/rts/T14900.stdout
index fdc259d094..a74cb09c28 100644
--- a/testsuite/tests/rts/T14900.stdout
+++ b/testsuite/tests/rts/T14900.stdout
@@ -1,3 +1,3 @@
-1
-1
+0
+0
Finished