[commit: ghc] master: RtsFlags: allow +RTS -K0 (f713be7)

git at git.haskell.org git at git.haskell.org
Mon Nov 27 15:21:45 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/f713be7a29052ee68bbe5f502533a9271898da74/ghc

>---------------------------------------------------------------

commit f713be7a29052ee68bbe5f502533a9271898da74
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Mon Nov 27 09:46:55 2017 -0500

    RtsFlags: allow +RTS -K0
    
    Reviewers: erikd, simonmar, hvr
    
    Reviewed By: hvr
    
    Subscribers: hvr, rwbarton, thomie
    
    Differential Revision: https://phabricator.haskell.org/D4238


>---------------------------------------------------------------

f713be7a29052ee68bbe5f502533a9271898da74
 rts/RtsFlags.c                  |  2 +-
 testsuite/tests/rts/all.T       |  3 +++
 testsuite/tests/rts/stack004.hs | 10 ++++++++++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c
index ecb9228..39b1273 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 935e10e..d5eaa76 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 0000000..4c9e337
--- /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"



More information about the ghc-commits mailing list