summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2020-08-23 20:35:52 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-08-24 10:04:20 -0400
commita77b9ec2a6153065565bca7bb154fff35b830b82 (patch)
treecd415e23fb913983c2e97cff2e6f67eb67f3b1ea
parentb1eb38a0a7168d7612c791c4289cc02d900d402f (diff)
downloadhaskell-a77b9ec2a6153065565bca7bb154fff35b830b82.tar.gz
Add a test for #18397
The bug was fixed by !3421.
-rw-r--r--testsuite/tests/codeGen/should_compile/T18397.hs20
-rw-r--r--testsuite/tests/codeGen/should_compile/all.T4
2 files changed, 24 insertions, 0 deletions
diff --git a/testsuite/tests/codeGen/should_compile/T18397.hs b/testsuite/tests/codeGen/should_compile/T18397.hs
new file mode 100644
index 0000000000..6941b811ba
--- /dev/null
+++ b/testsuite/tests/codeGen/should_compile/T18397.hs
@@ -0,0 +1,20 @@
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE UnboxedTuples #-}
+module T18397 where
+
+import GHC.Exts
+import GHC.ST
+
+data MutableArray s a = MutableArray (MutableArray# s a)
+
+runArray#
+ :: (forall s. ST s (MutableArray s a))
+ -> Array# a
+runArray# m = case runRW# $ \s ->
+ case unST m s of { (# s', MutableArray mary# #) ->
+ unsafeFreezeArray# mary# s'} of (# _, ary# #) -> ary#
+
+unST :: ST s a -> State# s -> (# State# s, a #)
+unST (ST f) = f
+
diff --git a/testsuite/tests/codeGen/should_compile/all.T b/testsuite/tests/codeGen/should_compile/all.T
index 4e0a25b7d5..cb61b2b44c 100644
--- a/testsuite/tests/codeGen/should_compile/all.T
+++ b/testsuite/tests/codeGen/should_compile/all.T
@@ -91,7 +91,11 @@ test('T17648', normal, makefile_test, [])
test('T17904', normal, compile, ['-O'])
test('T18227A', normal, compile, [''])
test('T18227B', normal, compile, [''])
+
+# runRW#-related
test('T18291', normal, compile, ['-O0'])
+test('T18397', normal, compile, ['-O0'])
+
test('T15570',
when(unregisterised(), skip),
compile, ['-Wno-overflowed-literals'])