Skip to content

GHC does not error on invalid RTS -K option

Summary

I'm having an issue with GHC 8.4.4, having compiled a binary with -rts-opts=all, when passing "+RTS -K1k -RTS" at runtime I don't think the stack limit is being honoured (I don't get any StackOverflows) - I tried other values to force it further, like -K1 but that also did nothing, so I tried presumably invalid values like -Kinvalid and my program ran normally.

To confirm that I do have -rts-opts capabilities I passed other params inside the +RTS/-RTS, like --help; I do get output (the help output lists -K as expected), and when passing -M1k the program fails immediately and I have to fiddle with values for -M until it works.

When passing invalid options to -M the RTS complains, too: "error in RTS option -Minvalid: size outside allowed range (4096 - 18446744073709551615)"

This does not happen with -Kinvalid.

Steps to reproduce

  1. Provide "+RTS -Kinvalid -RTS" to a binary compiled with GHC 8.4.4.
  2. Provide "+RTS -K1k -RTS" to a binary compiled with GHC 8.4.4.

Expected behavior

  1. I expect an RTS error due to the invalid param.
  2. I expect the program to run, but to provide a StackOverflow due to the stack size being too small.

Environment

  • GHC version used: Glasgow Haskell Compiler, Version 8.4.4, stage 2 booted by GHC version 8.4.4

Optional:

  • Operating System: Debian GNU/Linux 10 (buster)
  • System Architecture: x86_64
Edited by Adam Piper
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information