summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2014-08-07 10:08:00 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2014-08-07 10:08:00 +0100
commit2990e97f008c9703eb4b47e24a29d052d5735f00 (patch)
tree9026567a2bdaf6ce8fc65777d9b6edd3318be846
parent0957a9b0e3f9723761d12d9684c93209a8056755 (diff)
downloadhaskell-2990e97f008c9703eb4b47e24a29d052d5735f00.tar.gz
Test Trac #9390
-rw-r--r--testsuite/tests/simplCore/should_run/T9390.hs27
-rw-r--r--testsuite/tests/simplCore/should_run/T9390.stdout1
-rw-r--r--testsuite/tests/simplCore/should_run/all.T1
3 files changed, 29 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_run/T9390.hs b/testsuite/tests/simplCore/should_run/T9390.hs
new file mode 100644
index 0000000000..04b4da0e4d
--- /dev/null
+++ b/testsuite/tests/simplCore/should_run/T9390.hs
@@ -0,0 +1,27 @@
+{-# LANGUAGE MagicHash, UnboxedTuples #-}
+module Main(main ) where
+
+import GHC.IO (IO (..))
+import GHC.Prim
+
+writeB :: MutableArray# RealWorld Char -> IO ()
+writeB arr# = IO $ \s0# -> (# writeArray# arr# 0# 'B' s0#, () #)
+
+inlineWriteB :: MutableArray# RealWorld Char -> ()
+inlineWriteB arr# =
+ case f realWorld# of
+ (# _, x #) -> x
+ where
+ IO f = writeB arr#
+
+test :: IO Char
+test = IO $ \s0# ->
+ case newArray# 1# 'A' s0# of
+ (# s1#, arr# #) ->
+ case seq# (inlineWriteB arr#) s1# of
+ (# s2#, () #) ->
+ readArray# arr# 0# s2#
+
+main :: IO ()
+main = test >>= print
+
diff --git a/testsuite/tests/simplCore/should_run/T9390.stdout b/testsuite/tests/simplCore/should_run/T9390.stdout
new file mode 100644
index 0000000000..69349b451d
--- /dev/null
+++ b/testsuite/tests/simplCore/should_run/T9390.stdout
@@ -0,0 +1 @@
+'B'
diff --git a/testsuite/tests/simplCore/should_run/all.T b/testsuite/tests/simplCore/should_run/all.T
index e36fb00f0f..93dc4c66f9 100644
--- a/testsuite/tests/simplCore/should_run/all.T
+++ b/testsuite/tests/simplCore/should_run/all.T
@@ -67,3 +67,4 @@ test('T7924', exit_code(1), compile_and_run, [''])
test('T457', [ only_ways(['normal','optasm']), exit_code(1) ], compile_and_run, [''])
test('T9128', normal, compile_and_run, [''])
+test('T9390', normal, compile_and_run, [''])