summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2017-11-27 09:46:55 -0500
committerBen Gamari <ben@smart-cactus.org>2017-11-27 10:20:55 -0500
commitf713be7a29052ee68bbe5f502533a9271898da74 (patch)
tree74f04c3584c3fe99a024d7e13c73b37b3fa37189
parentb241d6db1a8155fc939700f01cc2fa5f89906f34 (diff)
downloadhaskell-f713be7a29052ee68bbe5f502533a9271898da74.tar.gz
RtsFlags: allow +RTS -K0
Reviewers: erikd, simonmar, hvr Reviewed By: hvr Subscribers: hvr, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4238
-rw-r--r--rts/RtsFlags.c2
-rw-r--r--testsuite/tests/rts/all.T3
-rw-r--r--testsuite/tests/rts/stack004.hs10
3 files changed, 14 insertions, 1 deletions
diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c
index ecb9228234..39b1273caa 100644
--- a/rts/RtsFlags.c
+++ b/rts/RtsFlags.c
@@ -1015,7 +1015,7 @@ error = true;
case 'K':
OPTION_UNSAFE;
RtsFlags.GcFlags.maxStkSize =
- decodeSize(rts_argv[arg], 2, sizeof(W_), HS_WORD_MAX)
+ decodeSize(rts_argv[arg], 2, 0, HS_WORD_MAX)
/ sizeof(W_);
break;
diff --git a/testsuite/tests/rts/all.T b/testsuite/tests/rts/all.T
index 935e10ecad..d5eaa76b4f 100644
--- a/testsuite/tests/rts/all.T
+++ b/testsuite/tests/rts/all.T
@@ -97,6 +97,9 @@ test('stack003', [ omit_ways('ghci'), # uses unboxed tuples
extra_run_opts('500000 +RTS -kc1k -kb100 -K96m -RTS') ],
compile_and_run, [''])
+# Test that +RTS -K0 (e.g. no stack limit) parses correctly
+test('stack004', [extra_run_opts('+RTS -K0 -RTS') ], compile_and_run, [''])
+
test('atomicinc', [ c_src, only_ways(['normal','threaded1', 'threaded2']) ], compile_and_run, [''])
test('atomicxchg', [ c_src, only_ways(['threaded1', 'threaded2']) ],
compile_and_run, [''])
diff --git a/testsuite/tests/rts/stack004.hs b/testsuite/tests/rts/stack004.hs
new file mode 100644
index 0000000000..4c9e337bbf
--- /dev/null
+++ b/testsuite/tests/rts/stack004.hs
@@ -0,0 +1,10 @@
+module Main where
+
+import Control.Monad
+import GHC.RTS.Flags
+
+-- Ensure that +RTS -K0 is parsed
+main :: IO ()
+main = do
+ flags <- getGCFlags
+ unless (maxStkSize flags == 0) $ putStrLn "uh oh"