From fe1c80d20bf625fb351eeb47f5e4b218c89182a8 Mon Sep 17 00:00:00 2001 From: Andreas Klebinger Date: Tue, 16 Mar 2021 11:27:06 +0100 Subject: 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. --- testsuite/tests/perf/should_run/T19474.hs | 15 +++++++++++++++ testsuite/tests/perf/should_run/all.T | 4 ++++ 2 files changed, 19 insertions(+) create mode 100644 testsuite/tests/perf/should_run/T19474.hs 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']) -- cgit v1.2.1