Skip to content

Use safe conversion functions for parsing RTS number arguments.

Motivation

The GHC RTS currently gladly accepts bogus input like ghc +RTS -ibogus.

The reason for this is that the rest of the string after -i will be passed to atof. atof will fail to convert it to a number and silently returns zero.

I've recently spent far too long trying to debug an error where it turned out I used - instead of --. Handling this as proposed below would have made this obvious immediately.

Proposal

GHC Should report a error in cases like the example above. This can likely be solved by using strtof instead of atof and checking for failed conversions.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information