summaryrefslogtreecommitdiff
path: root/testsuite/tests/rts
diff options
context:
space:
mode:
authorSimon Marlow <smarlow@fb.com>2018-04-27 11:31:19 -0700
committerSimon Marlow <marlowsd@gmail.com>2018-05-02 12:48:38 +0100
commit4cb5595e5e800818721a623a5419cad29a528000 (patch)
tree596ea21e66144540e8cb696d0b8c34d7cf2eece1 /testsuite/tests/rts
parentdc655bf0310012b193cf49cce9f5b0bfbc53764c (diff)
downloadhaskell-4cb5595e5e800818721a623a5419cad29a528000.tar.gz
storageAddCapabilities: fix bug in updating nursery pointers
Summary: We were unconditionally updating the nursery pointers to be `nurseries[cap->no]`, but when using nursery chunks this might be wrong. This manifested as a later assertion failure in allocate(). Test Plan: new test case Reviewers: bgamari, niteria, erikd Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4649
Diffstat (limited to 'testsuite/tests/rts')
-rw-r--r--testsuite/tests/rts/all.T7
-rw-r--r--testsuite/tests/rts/nursery-chunks1.hs12
2 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/tests/rts/all.T b/testsuite/tests/rts/all.T
index a2783887af..8fa2257b1c 100644
--- a/testsuite/tests/rts/all.T
+++ b/testsuite/tests/rts/all.T
@@ -402,3 +402,10 @@ test('alloccounter1', normal, compile_and_run,
# allocation and messes up the results:
'-with-rtsopts=-k1m'
])
+
+test('nursery-chunks1',
+ [ extra_run_opts('4 100 +RTS -n32k -A1m -RTS')
+ , only_ways(['threaded1','threaded2'])
+ ],
+ compile_and_run,
+ [''])
diff --git a/testsuite/tests/rts/nursery-chunks1.hs b/testsuite/tests/rts/nursery-chunks1.hs
new file mode 100644
index 0000000000..f8f9f6a7fa
--- /dev/null
+++ b/testsuite/tests/rts/nursery-chunks1.hs
@@ -0,0 +1,12 @@
+-- Test for a bug that provoked the following assertion failure:
+-- nursery-chunks1: internal error: ASSERTION FAILED: file rts/sm/Sanity.c, line 903
+module Main (main) where
+
+import Control.Monad
+import System.Environment
+import GHC.Conc
+
+main = do
+ [n,m] <- fmap read <$> getArgs
+ forM_ [1..n] $ \n' ->
+ when (sum [1.. m::Integer] > 0) $ setNumCapabilities (fromIntegral n')