summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2021-03-16 11:27:06 +0100
committerAndreas Klebinger <klebinger.andreas@gmx.at>2021-04-05 08:56:40 -0400
commitfe1c80d20bf625fb351eeb47f5e4b218c89182a8 (patch)
treec0aa740f65c18a1c77aff1b9a2ab39fe8df2d28a
parentce706faeef3964116c6e1dd0e6ae2f2e77fde57d (diff)
downloadhaskell-wip/T19474.tar.gz
Add regression test for T19474.wip/T19474
In version 0.12.2.0 of vector when used with GHC-9.0 we rebox values from storeable mutable vectors. This should catch such a change in the future.
-rw-r--r--testsuite/tests/perf/should_run/T19474.hs15
-rw-r--r--testsuite/tests/perf/should_run/all.T4
2 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/tests/perf/should_run/T19474.hs b/testsuite/tests/perf/should_run/T19474.hs
new file mode 100644
index 0000000000..8379a4debd
--- /dev/null
+++ b/testsuite/tests/perf/should_run/T19474.hs
@@ -0,0 +1,15 @@
+module T19474 where
+
+import Control.Monad
+import qualified Data.Vector.Storable.Mutable as M
+
+main = do
+ v <- M.new 1
+ forM_ [0..10000] $ \some -> do
+ addSome v 0 some
+ M.unsafeRead v 0 >>= print
+
+addSome :: M.IOVector Int -> Int -> Int -> IO ()
+addSome m idx some = do
+ val <- M.unsafeRead m idx
+ M.unsafeWrite m idx $ val + some
diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T
index d7257472e2..6e603b46f4 100644
--- a/testsuite/tests/perf/should_run/all.T
+++ b/testsuite/tests/perf/should_run/all.T
@@ -395,3 +395,7 @@ test('T19347',
compile_and_run,
['-O'])
+test ('T19474',
+ [ collect_stats('bytes allocated', 5), reqlib('vector') ],
+ compile_and_run,
+ ['-v0 -O'])