summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2021-03-16 11:27:06 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-04-05 20:41:41 -0400
commit33b886453d8dbf030998d77aa970c90a27fde19f (patch)
tree898a78d67ac8ea50c906133defa2dda2455c77b3
parent2783d4981e4079f87a9d06036ea393949a5580b9 (diff)
downloadhaskell-33b886453d8dbf030998d77aa970c90a27fde19f.tar.gz
Add regression test for 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'])